Move to version 3 of the REST API.

Rename packet capture endpoints.
This commit is contained in:
grossmj committed 2020-11-02 12:05:32 +10:30
1 parent eeaf10b418
commit 359f9a7384
34 files changed
+120 -118

No files matched your search

+27 -27
View File
@@ -136,31 +136,6 @@ async def update_link(link_data: schemas.Link, link: Link = Depends(dep_link)):
return link.__json__()
@router.post("/{link_id}/start_capture",
status_code=status.HTTP_201_CREATED,
response_model=schemas.Link,
responses=responses)
async def start_capture(capture_data: dict, link: Link = Depends(dep_link)):
"""
Start packet capture on the link.
"""
await link.start_capture(data_link_type=capture_data.get("data_link_type", "DLT_EN10MB"),
capture_file_name=capture_data.get("capture_file_name"))
return link.__json__()
@router.post("/{link_id}/stop_capture",
status_code=status.HTTP_204_NO_CONTENT,
responses=responses)
async def stop_capture(link: Link = Depends(dep_link)):
"""
Stop packet capture on the link.
"""
await link.stop_capture()
@router.delete("/{link_id}",
status_code=status.HTTP_204_NO_CONTENT,
responses=responses)
@@ -185,9 +160,34 @@ async def reset_link(link: Link = Depends(dep_link)):
return link.__json__()
@router.get("/{link_id}/pcap",
@router.post("/{link_id}/capture/start",
status_code=status.HTTP_201_CREATED,
response_model=schemas.Link,
responses=responses)
async def start_capture(capture_data: dict, link: Link = Depends(dep_link)):
"""
Start packet capture on the link.
"""
await link.start_capture(data_link_type=capture_data.get("data_link_type", "DLT_EN10MB"),
capture_file_name=capture_data.get("capture_file_name"))
return link.__json__()
@router.post("/{link_id}/capture/stop",
status_code=status.HTTP_204_NO_CONTENT,
responses=responses)
async def stop_capture(link: Link = Depends(dep_link)):
"""
Stop packet capture on the link.
"""
await link.stop_capture()
@router.get("/{link_id}/capture/stream",
responses=responses)
async def pcap(request: Request, link: Link = Depends(dep_link)):
async def stream_pcap(request: Request, link: Link = Depends(dep_link)):
"""
Stream the PCAP capture file from compute.
"""
+1 -1
View File
@@ -380,7 +380,7 @@ async def ws_console(websocket: WebSocket, node: Node = Depends(dep_node)):
compute = node.compute
await websocket.accept()
log.info(f"New client {websocket.client.host}:{websocket.client.port} has connected to controller console WebSocket")
ws_console_compute_url = f"ws://{compute.host}:{compute.port}/v2/compute/projects/" \
ws_console_compute_url = f"ws://{compute.host}:{compute.port}/v3/compute/projects/" \
f"{node.project.id}/{node.node_type}/nodes/{node.id}/console/ws"
async def ws_receive(ws_console_compute):