Skip to content
Snippets Groups Projects
Commit 0af0d764 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Pre-merge code cleanup

parent 9e097570
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!284Resolve: "(CNIT) Multi-Granular Optical Nodes and Optical Transpoders management"
This commit is part of merge request !284. Comments created here will be created in the context of that merge request.
{
"1": {
"optical_band_id": 1,
"bidir": 0,
"src": "R1",
"dst": "R2",
"flows": {
"R1": {
"f": {
"in": "0",
"out": "101"
},
"b": {}
},
"R2": {
"f": {
"in": "111",
"out": "0"
},
"b": {}
}
},
"band_type": "c_slots",
"fiber_forward": {},
"fiber_backward": {},
"op-mode": 0,
"n_slots": 16,
"links": [
"R1-R2"
],
"path": [
"R1",
"R2"
],
"band": 200000,
"freq": 192106250,
"is_active": false,
"src_port": "101",
"dst_port": "111",
"rev_dst_port": "111",
"rev_src_port": "101",
"c_slots": {
"1": 1,
"2": 1,
"3": 1,
"4": 1,
"5": 1,
"6": 1,
"7": 1,
"8": 1,
"9": 1,
"10": 1,
"11": 1,
"12": 1,
"13": 1,
"14": 1,
"15": 1,
"16": 1
},
"served_lightpaths": []
}
}
\ No newline at end of file
{"1": {"flow_id": 1, "src": "T1.1", "dst": "T2.1", "bitrate": 100, "bidir": 0, "flows": {"T1.1": {"f": {"in": "0", "out": "1"}, "b": {}}, "R1": {"f": {"in": "12", "out": "101"}, "b": {}}, "R2": {"f": {"in": "111", "out": "2"}, "b": {}}, "T2.1": {"f": {"in": "6", "out": "0"}, "b": {}}}, "band_type": "c_slots", "slots": [1, 2, 3, 4], "fiber_forward": {}, "fiber_backward": {}, "op-mode": 1, "n_slots": 4, "links": ["T1.1-R1", "R2-T2.1"], "path": ["R1", "R2"], "band": 50000, "freq": 192031250, "is_active": false, "parent_opt_band": 1, "new_optical_band": 1}, "2": {"flow_id": 2, "src": "T1.1", "dst": "T2.1", "bitrate": 100, "bidir": 0, "flows": {"T1.1": {"f": {"in": "0", "out": "1"}, "b": {}}, "R1": {"f": {"in": "12", "out": "101"}, "b": {}}, "R2": {"f": {"in": "111", "out": "2"}, "b": {}}, "T2.1": {"f": {"in": "6", "out": "0"}, "b": {}}}, "band_type": "c_slots", "slots": [5, 6, 7, 8], "fiber_forward": {}, "fiber_backward": {}, "op-mode": 1, "n_slots": 4, "links": ["T1.1-R1", "R2-T2.1"], "path": ["T1.1", "R1", "R2", "T2.1"], "band": 50000, "freq": 192081250, "is_active": false, "parent_opt_band": 1, "new_optical_band": 0}}
......@@ -34,20 +34,20 @@ RUN python3 -m pip install --upgrade pip-tools
# Get common Python packages
# Note: this step enables sharing the previous Docker build steps among all the Python components
WORKDIR /var/teraflow/opticalcontroller/
WORKDIR /var/teraflow/
COPY common_requirements.in common_requirements.in
RUN pip-compile --quiet --output-file=common_requirements.txt common_requirements.in
RUN python3 -m pip install -r common_requirements.txt
# Add common files into working directory
WORKDIR /var/teraflow/opticalcontroller/common
WORKDIR /var/teraflow/common
COPY src/common/. ./
RUN rm -rf proto
# Create proto sub-folder, copy .proto files, and generate Python code
RUN mkdir -p /var/teraflow/opticalcontroller/common/proto
WORKDIR /var/teraflow/opticalcontroller/common/proto
RUN mkdir -p /var/teraflow/common/proto
WORKDIR /var/teraflow/common/proto
RUN touch __init__.py
COPY proto/*.proto ./
RUN python3 -m grpc_tools.protoc -I=. --python_out=. --grpc_python_out=. *.proto
......@@ -55,19 +55,18 @@ RUN rm *.proto
RUN find . -type f -exec sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' {} \;
# Create component sub-folders, get specific Python packages
WORKDIR /var/teraflow/
RUN mkdir -p /var/teraflow/opticalcontroller
WORKDIR /var/teraflow/opticalcontroller
COPY src/opticalcontroller/requirements.in requirements.in
RUN pip-compile --quiet --output-file=requirements.txt requirements.in
RUN python3 -m pip install -r requirements.txt
# Add component files into working directory
WORKDIR /var/teraflow/opticalcontroller/
WORKDIR /var/teraflow/
COPY src/context/__init__.py context/__init__.py
COPY src/context/client/. context/client/
COPY src/opticalcontroller/. ./
COPY src/opticalcontroller/. opticalcontroller/
# Start the service
WORKDIR /var/teraflow/opticalcontroller
ENTRYPOINT ["python", "OpticalController.py"]
{
"1": {
"optical_band_id": 1,
"bidir": 0,
"src": "R1",
"dst": "R2",
"flows": {
"R1": {
"f": {
"in": "0",
"out": "101"
},
"b": {}
},
"R2": {
"f": {
"in": "111",
"out": "0"
},
"b": {}
}
},
"band_type": "c_slots",
"fiber_forward": {},
"fiber_backward": {},
"op-mode": 0,
"n_slots": 16,
"links": [
"R1-R2"
],
"path": [
"R1",
"R2"
],
"band": 200000,
"freq": 192106250,
"is_active": true,
"src_port": "101",
"dst_port": "111",
"rev_dst_port": "111",
"rev_src_port": "101",
"c_slots": {
"1": 1,
"2": 1,
"3": 1,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 1,
"9": 1,
"10": 1,
"11": 1,
"12": 1,
"13": 1,
"14": 1,
"15": 1,
"16": 1
},
"served_lightpaths": [
3
]
},
"2": {
"optical_band_id": 2,
"bidir": 1,
"src": "R1",
"dst": "R2",
"flows": {
"R1": {
"f": {
"in": "0",
"out": "101"
},
"b": {
"in": "111",
"out": "0"
}
},
"R2": {
"f": {
"in": "111",
"out": "0"
},
"b": {
"in": "0",
"out": "101"
}
}
},
"band_type": "l_slots",
"fiber_forward": {},
"fiber_backward": {},
"op-mode": 0,
"n_slots": 16,
"links": [
"R1-R2"
],
"path": [
"R1",
"R2"
],
"band": 200000,
"freq": 186156250,
"is_active": true,
"src_port": "101",
"dst_port": "111",
"rev_dst_port": "111",
"rev_src_port": "101",
"l_slots": {
"101": 1,
"102": 1,
"103": 1,
"104": 1,
"105": 1,
"106": 1,
"107": 1,
"108": 1,
"109": 1,
"110": 1,
"111": 1,
"112": 1,
"113": 1,
"114": 1,
"115": 1,
"116": 1
},
"served_lightpaths": []
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment