Loading src/pathcomp/frontend/service/OpticalPathComp.py +2 −221 Original line number Diff line number Diff line Loading @@ -134,221 +134,6 @@ def _optical_path_computation(service: Service, is_recompute: bool = False) -> P resp_json = resp.json() LOGGER.info(f"Optical Path Computation Response: {resp_json}") # MOCK RESPONSE (If the Optical Controller is down) # if is_recompute: # resp_json = { # "overridden_records": { # "T2.1": { # "sources": [ # "T1.1", # "T1.3" # ], # "destinations": [ # "T2.1" # ], # "flow_id": 5, # "established_via": "ComputeP2MP", # "timestamp": "2026-06-29T14:45:33.546337+00:00", # "bitrate": 100, # "bidirectional": False, # "frequency": 0, # "band": 100, # "subcarriers_per_source": [ # 4, # 4 # ] # } # }, # "tapi-connectivity:connectivity-service": { # "connection": [ # { # "optical-connection-attributes": { # "central-frequency": 195000000000000, # "Tx-power": 0, # "modulation": { # "modulation-technique": "DP-16QAM", # "operational-mode": 9, # "port": "port-1" # }, # "digital-subcarrier-spacing": 300000000, # "subcarrier-attributes": { # "digital-subcarrier-group": [ # { # "group-id": 1, # "modulation-technique": "DP-QPSK", # "central-frequency": 195006250, # "operational-mode": 4, # "Tx-power": -99, # "group-size": 4, # "port": "port-1", # "subcarrier-id": [1, 2, 3, 4] # }, # { # "group-id": 2, # "modulation-technique": "DP-QPSK", # "central-frequency": 195018750, # "operational-mode": 4, # "Tx-power": -99, # "group-size": 4, # "port": "port-3", # "subcarrier-id": [5, 6, 7, 8] # }, # { # "group-id": 3, # "modulation-technique": "DP-QPSK", # "central-frequency": 195031250, # "operational-mode": 4, # "Tx-power": -99, # "group-size": 4, # "port": "port-5", # "subcarrier-id": [9, 10, 11, 12] # } # ] # } # }, # "end-point": [ # { # "direction": "BIDIRECTIONAL", # "layer-protocol-name": "PHOTONIC_MEDIA", # "layer-protocol-qualifier": "tapi-photonic-media:PHOTONIC_LAYER_QUALIFIER_MC", # "local-id": "T1.3", # "service-interface-point": { # "service-interface-point-uuid": "T2.1" # }, # "tapi-photonic-media:media-channel-connectivity-service-end-point-spec": { # "mc-config": { # "spectrum": { # "center-frequency": 195000000000000, # "frequency-constraint": { # "adjustment-granularity": "G_6_25GHZ", # "grid-type": "FLEX" # } # } # } # } # }, # { # "direction": "BIDIRECTIONAL", # "layer-protocol-name": "PHOTONIC_MEDIA", # "layer-protocol-qualifier": "tapi-photonic-media:PHOTONIC_LAYER_QUALIFIER_MC", # "local-id": "T2.1", # "service-interface-point": { # "service-interface-point-uuid": "T1.1" # }, # "tapi-photonic-media:media-channel-connectivity-service-end-point-spec": { # "mc-config": { # "spectrum": { # "center-frequency": 195036250, # "frequency-constraint": { # "adjustment-granularity": "G_6_25GHZ", # "grid-type": "FLEX" # } # } # } # } # } # ] # } # ] # } # } # else: # resp_json = { # "tapi-connectivity:connectivity-service": { # "connection": [ # { # "optical-connection-attributes": { # "central-frequency": 195000000000000, # "Tx-power": 0, # "modulation": { # "modulation-technique": "DP-16QAM", # "operational-mode": 9, # "port": "port-1" # }, # "digital-subcarrier-spacing": 300000000, # "subcarrier-attributes": { # "digital-subcarrier-group": [ # { # "group-id": 1, # "modulation-technique": "DP-QPSK", # "central-frequency": 195006250, # "operational-mode": 4, # "Tx-power": -99, # "group-size": 4, # "port": "port-1", # "subcarrier-id": [1, 2, 3, 4] # }, # { # "group-id": 2, # "modulation-technique": "DP-QPSK", # "central-frequency": 195018750, # "operational-mode": 4, # "Tx-power": -99, # "group-size": 4, # "port": "port-3", # "subcarrier-id": [5, 6, 7, 8] # }, # { # "group-id": 3, # "modulation-technique": "DP-QPSK", # "central-frequency": 195031250, # "operational-mode": 4, # "Tx-power": -99, # "group-size": 4, # "port": "port-5", # "subcarrier-id": [9, 10, 11, 12] # } # ] # } # }, # "end-point": [ # { # "direction": "BIDIRECTIONAL", # "layer-protocol-name": "PHOTONIC_MEDIA", # "layer-protocol-qualifier": "tapi-photonic-media:PHOTONIC_LAYER_QUALIFIER_MC", # "local-id": "T1.1", # "service-interface-point": { # "service-interface-point-uuid": "T2.1" # }, # "tapi-photonic-media:media-channel-connectivity-service-end-point-spec": { # "mc-config": { # "spectrum": { # "center-frequency": 195000000000000, # "frequency-constraint": { # "adjustment-granularity": "G_6_25GHZ", # "grid-type": "FLEX" # } # } # } # } # }, # { # "direction": "BIDIRECTIONAL", # "layer-protocol-name": "PHOTONIC_MEDIA", # "layer-protocol-qualifier": "tapi-photonic-media:PHOTONIC_LAYER_QUALIFIER_MC", # "local-id": "T2.1", # "service-interface-point": { # "service-interface-point-uuid": "T1.1" # }, # "tapi-photonic-media:media-channel-connectivity-service-end-point-spec": { # "mc-config": { # "spectrum": { # "center-frequency": 195006250, # "frequency-constraint": { # "adjustment-granularity": "G_6_25GHZ", # "grid-type": "FLEX" # } # } # } # } # } # ] # } # ] # } # } # Generate Rules src_name = source # T2.1 dest_list = destinations_list # T1.1, T1.2 Loading Loading @@ -418,11 +203,7 @@ def _optical_path_computation(service: Service, is_recompute: bool = False) -> P name = "channel-1" freq_raw = group.get("central-frequency", 195006250) freq_val = int(freq_raw / 1e6) if freq_raw > 1e10 else int(freq_raw) # if freq_val == hub_freq: # freq = hub_freq + 6250 + index * 12500 # else: freq = freq_val freq = int(freq_raw / 1e6) if freq_raw > 1e10 else int(freq_raw) leaf = { "name": name, Loading Loading
src/pathcomp/frontend/service/OpticalPathComp.py +2 −221 Original line number Diff line number Diff line Loading @@ -134,221 +134,6 @@ def _optical_path_computation(service: Service, is_recompute: bool = False) -> P resp_json = resp.json() LOGGER.info(f"Optical Path Computation Response: {resp_json}") # MOCK RESPONSE (If the Optical Controller is down) # if is_recompute: # resp_json = { # "overridden_records": { # "T2.1": { # "sources": [ # "T1.1", # "T1.3" # ], # "destinations": [ # "T2.1" # ], # "flow_id": 5, # "established_via": "ComputeP2MP", # "timestamp": "2026-06-29T14:45:33.546337+00:00", # "bitrate": 100, # "bidirectional": False, # "frequency": 0, # "band": 100, # "subcarriers_per_source": [ # 4, # 4 # ] # } # }, # "tapi-connectivity:connectivity-service": { # "connection": [ # { # "optical-connection-attributes": { # "central-frequency": 195000000000000, # "Tx-power": 0, # "modulation": { # "modulation-technique": "DP-16QAM", # "operational-mode": 9, # "port": "port-1" # }, # "digital-subcarrier-spacing": 300000000, # "subcarrier-attributes": { # "digital-subcarrier-group": [ # { # "group-id": 1, # "modulation-technique": "DP-QPSK", # "central-frequency": 195006250, # "operational-mode": 4, # "Tx-power": -99, # "group-size": 4, # "port": "port-1", # "subcarrier-id": [1, 2, 3, 4] # }, # { # "group-id": 2, # "modulation-technique": "DP-QPSK", # "central-frequency": 195018750, # "operational-mode": 4, # "Tx-power": -99, # "group-size": 4, # "port": "port-3", # "subcarrier-id": [5, 6, 7, 8] # }, # { # "group-id": 3, # "modulation-technique": "DP-QPSK", # "central-frequency": 195031250, # "operational-mode": 4, # "Tx-power": -99, # "group-size": 4, # "port": "port-5", # "subcarrier-id": [9, 10, 11, 12] # } # ] # } # }, # "end-point": [ # { # "direction": "BIDIRECTIONAL", # "layer-protocol-name": "PHOTONIC_MEDIA", # "layer-protocol-qualifier": "tapi-photonic-media:PHOTONIC_LAYER_QUALIFIER_MC", # "local-id": "T1.3", # "service-interface-point": { # "service-interface-point-uuid": "T2.1" # }, # "tapi-photonic-media:media-channel-connectivity-service-end-point-spec": { # "mc-config": { # "spectrum": { # "center-frequency": 195000000000000, # "frequency-constraint": { # "adjustment-granularity": "G_6_25GHZ", # "grid-type": "FLEX" # } # } # } # } # }, # { # "direction": "BIDIRECTIONAL", # "layer-protocol-name": "PHOTONIC_MEDIA", # "layer-protocol-qualifier": "tapi-photonic-media:PHOTONIC_LAYER_QUALIFIER_MC", # "local-id": "T2.1", # "service-interface-point": { # "service-interface-point-uuid": "T1.1" # }, # "tapi-photonic-media:media-channel-connectivity-service-end-point-spec": { # "mc-config": { # "spectrum": { # "center-frequency": 195036250, # "frequency-constraint": { # "adjustment-granularity": "G_6_25GHZ", # "grid-type": "FLEX" # } # } # } # } # } # ] # } # ] # } # } # else: # resp_json = { # "tapi-connectivity:connectivity-service": { # "connection": [ # { # "optical-connection-attributes": { # "central-frequency": 195000000000000, # "Tx-power": 0, # "modulation": { # "modulation-technique": "DP-16QAM", # "operational-mode": 9, # "port": "port-1" # }, # "digital-subcarrier-spacing": 300000000, # "subcarrier-attributes": { # "digital-subcarrier-group": [ # { # "group-id": 1, # "modulation-technique": "DP-QPSK", # "central-frequency": 195006250, # "operational-mode": 4, # "Tx-power": -99, # "group-size": 4, # "port": "port-1", # "subcarrier-id": [1, 2, 3, 4] # }, # { # "group-id": 2, # "modulation-technique": "DP-QPSK", # "central-frequency": 195018750, # "operational-mode": 4, # "Tx-power": -99, # "group-size": 4, # "port": "port-3", # "subcarrier-id": [5, 6, 7, 8] # }, # { # "group-id": 3, # "modulation-technique": "DP-QPSK", # "central-frequency": 195031250, # "operational-mode": 4, # "Tx-power": -99, # "group-size": 4, # "port": "port-5", # "subcarrier-id": [9, 10, 11, 12] # } # ] # } # }, # "end-point": [ # { # "direction": "BIDIRECTIONAL", # "layer-protocol-name": "PHOTONIC_MEDIA", # "layer-protocol-qualifier": "tapi-photonic-media:PHOTONIC_LAYER_QUALIFIER_MC", # "local-id": "T1.1", # "service-interface-point": { # "service-interface-point-uuid": "T2.1" # }, # "tapi-photonic-media:media-channel-connectivity-service-end-point-spec": { # "mc-config": { # "spectrum": { # "center-frequency": 195000000000000, # "frequency-constraint": { # "adjustment-granularity": "G_6_25GHZ", # "grid-type": "FLEX" # } # } # } # } # }, # { # "direction": "BIDIRECTIONAL", # "layer-protocol-name": "PHOTONIC_MEDIA", # "layer-protocol-qualifier": "tapi-photonic-media:PHOTONIC_LAYER_QUALIFIER_MC", # "local-id": "T2.1", # "service-interface-point": { # "service-interface-point-uuid": "T1.1" # }, # "tapi-photonic-media:media-channel-connectivity-service-end-point-spec": { # "mc-config": { # "spectrum": { # "center-frequency": 195006250, # "frequency-constraint": { # "adjustment-granularity": "G_6_25GHZ", # "grid-type": "FLEX" # } # } # } # } # } # ] # } # ] # } # } # Generate Rules src_name = source # T2.1 dest_list = destinations_list # T1.1, T1.2 Loading Loading @@ -418,11 +203,7 @@ def _optical_path_computation(service: Service, is_recompute: bool = False) -> P name = "channel-1" freq_raw = group.get("central-frequency", 195006250) freq_val = int(freq_raw / 1e6) if freq_raw > 1e10 else int(freq_raw) # if freq_val == hub_freq: # freq = hub_freq + 6250 + index * 12500 # else: freq = freq_val freq = int(freq_raw / 1e6) if freq_raw > 1e10 else int(freq_raw) leaf = { "name": name, Loading