Loading my_deploy.sh +3 −3 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ export TFS_COMPONENTS="context device pathcomp service nbi webui" #export TFS_COMPONENTS="${TFS_COMPONENTS} forecaster" # Uncomment to activate E2E Orchestrator #export TFS_COMPONENTS="${TFS_COMPONENTS} e2e_orchestrator" export TFS_COMPONENTS="${TFS_COMPONENTS} e2e_orchestrator" # Uncomment to activate VNT Manager #export TFS_COMPONENTS="${TFS_COMPONENTS} vnt_manager" Loading Loading @@ -143,7 +143,7 @@ export CRDB_PASSWORD="tfs123" export CRDB_DEPLOY_MODE="single" # Disable flag for dropping database, if it exists. export CRDB_DROP_DATABASE_IF_EXISTS="" export CRDB_DROP_DATABASE_IF_EXISTS="YES" # Disable flag for re-deploying CockroachDB from scratch. export CRDB_REDEPLOY="" Loading Loading @@ -211,7 +211,7 @@ export QDB_TABLE_MONITORING_KPIS="tfs_monitoring_kpis" export QDB_TABLE_SLICE_GROUPS="tfs_slice_groups" # Disable flag for dropping tables if they exist. export QDB_DROP_TABLES_IF_EXIST="" export QDB_DROP_TABLES_IF_EXIST="YES" # Disable flag for re-deploying QuestDB from scratch. export QDB_REDEPLOY="" Loading src/device/service/drivers/ietf_l3vpn/IetfL3VpnDriver.py +10 −9 Original line number Diff line number Diff line Loading @@ -191,15 +191,16 @@ class IetfL3VpnDriver(_Driver): if len(resources) == 0: return results with self.__lock: if 'ipowdm' in str(resources): for resource in resources: if 'ipowdm' in str(resource): try: create_request(resource) LOGGER.info('Request created successfully') results.append((resource, True)) except Exception as e: MSG = 'Invalid resource_value type: expected dict, got {:s}' results.append((resource, e)) LOGGER.info('Processing IPoWDM resources: {:s}'.format(str(resources))) # for resource in resources: # if 'ipowdm' in str(resource): # try: # create_request(resource) # LOGGER.info('Request created successfully') # results.append((resource, True)) # except Exception as e: # MSG = 'Invalid resource_value type: expected dict, got {:s}' # results.append((resource, e)) else: for resource in resources: resource_key, resource_value = resource Loading src/pathcomp/frontend/service/OpticalPathComp.py +4 −3 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import logging import uuid from common.proto.context_pb2 import Service, ConfigRule, ConfigActionEnum from common.proto.pathcomp_pb2 import PathCompReply from .TopologyTools import get_device_with_driver LOGGER = logging.getLogger(__name__) Loading Loading @@ -395,20 +396,20 @@ def compute_optical_path(service: Service) -> PathCompReply: "src-ip-mask": str(nodes[src_name]["ip-mask"]), "src-vlan-id": nodes[src_name]["vlan-id"], } if device_name: content["device_name"] = device_name for i, dest in enumerate(dest_list): if dest in nodes: content[f"dest{i+1}-node-uuid"] = dest content[f"dest{i+1}-ip-address"] = nodes[dest]["ip-address"] content[f"dest{i+1}-ip-mask"] = str(nodes[dest]["ip-mask"]) content[f"dest{i+1}-vlan-id"] = nodes[dest]["vlan-id"] controller_ip = get_device_with_driver() provisionamiento["actions"].append({ "type": "CONFIG_VPNL3", "layer": "IP", "content": content, "controller-uuid": "IP Controller" "controller_uuid": controller_ip }) config_rules.append(provisionamiento) Loading src/pathcomp/frontend/service/TopologyTools.py +35 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import logging, math import logging, math, os, socket, requests from typing import Dict, Optional from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME, ServiceNameEnum from common.Settings import ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, find_environment_variables, get_env_var_name Loading @@ -25,6 +25,7 @@ from common.tools.grpc.Tools import grpc_message_to_json_string from context.client.ContextClient import ContextClient from forecaster.client.ForecasterClient import ForecasterClient LOGGER = logging.getLogger(__name__) def get_service_schedule(service : Service) -> Optional[Constraint_Schedule]: Loading Loading @@ -96,3 +97,36 @@ def get_pathcomp_topology_details(request : PathCompRequest, allow_forecasting : link.attributes.total_capacity_gbps = total_capacity_gbps return topology_details # The HOST IP of the TFS controller is needed to query the devices and get the # IP address of the controller to be used in the path provisioning. ENVVAR_TFS_API_HOST = '10.95.89.50' def get_device_with_driver(driver_name: str = 'DEVICEDRIVER_IETF_L3VPN', timeout: int = 10): """Query the TFS controller REST API and return the _connect/address value of the first device with the given driver. Example: GET http://<vm-ip>/tfs-api/devices Returns the _connect/address string or None. """ url = f'http://{ENVVAR_TFS_API_HOST}:80/tfs-api/devices' try: logging.debug("Requesting devices from %s", url) resp = requests.get(url, timeout=timeout) resp.raise_for_status() data = resp.json() except Exception as e: logging.warning("Error fetching devices from %s: %s", url, e) return None devices = data.get('devices', []) if isinstance(data, dict) else [] for dev in devices: drivers = dev.get('device_drivers') or [] if isinstance(drivers, list) and driver_name in drivers: device_name = dev.get('name') return device_name logging.info("No device with driver %s found on %s", driver_name, url) return None Loading
my_deploy.sh +3 −3 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ export TFS_COMPONENTS="context device pathcomp service nbi webui" #export TFS_COMPONENTS="${TFS_COMPONENTS} forecaster" # Uncomment to activate E2E Orchestrator #export TFS_COMPONENTS="${TFS_COMPONENTS} e2e_orchestrator" export TFS_COMPONENTS="${TFS_COMPONENTS} e2e_orchestrator" # Uncomment to activate VNT Manager #export TFS_COMPONENTS="${TFS_COMPONENTS} vnt_manager" Loading Loading @@ -143,7 +143,7 @@ export CRDB_PASSWORD="tfs123" export CRDB_DEPLOY_MODE="single" # Disable flag for dropping database, if it exists. export CRDB_DROP_DATABASE_IF_EXISTS="" export CRDB_DROP_DATABASE_IF_EXISTS="YES" # Disable flag for re-deploying CockroachDB from scratch. export CRDB_REDEPLOY="" Loading Loading @@ -211,7 +211,7 @@ export QDB_TABLE_MONITORING_KPIS="tfs_monitoring_kpis" export QDB_TABLE_SLICE_GROUPS="tfs_slice_groups" # Disable flag for dropping tables if they exist. export QDB_DROP_TABLES_IF_EXIST="" export QDB_DROP_TABLES_IF_EXIST="YES" # Disable flag for re-deploying QuestDB from scratch. export QDB_REDEPLOY="" Loading
src/device/service/drivers/ietf_l3vpn/IetfL3VpnDriver.py +10 −9 Original line number Diff line number Diff line Loading @@ -191,15 +191,16 @@ class IetfL3VpnDriver(_Driver): if len(resources) == 0: return results with self.__lock: if 'ipowdm' in str(resources): for resource in resources: if 'ipowdm' in str(resource): try: create_request(resource) LOGGER.info('Request created successfully') results.append((resource, True)) except Exception as e: MSG = 'Invalid resource_value type: expected dict, got {:s}' results.append((resource, e)) LOGGER.info('Processing IPoWDM resources: {:s}'.format(str(resources))) # for resource in resources: # if 'ipowdm' in str(resource): # try: # create_request(resource) # LOGGER.info('Request created successfully') # results.append((resource, True)) # except Exception as e: # MSG = 'Invalid resource_value type: expected dict, got {:s}' # results.append((resource, e)) else: for resource in resources: resource_key, resource_value = resource Loading
src/pathcomp/frontend/service/OpticalPathComp.py +4 −3 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ import logging import uuid from common.proto.context_pb2 import Service, ConfigRule, ConfigActionEnum from common.proto.pathcomp_pb2 import PathCompReply from .TopologyTools import get_device_with_driver LOGGER = logging.getLogger(__name__) Loading Loading @@ -395,20 +396,20 @@ def compute_optical_path(service: Service) -> PathCompReply: "src-ip-mask": str(nodes[src_name]["ip-mask"]), "src-vlan-id": nodes[src_name]["vlan-id"], } if device_name: content["device_name"] = device_name for i, dest in enumerate(dest_list): if dest in nodes: content[f"dest{i+1}-node-uuid"] = dest content[f"dest{i+1}-ip-address"] = nodes[dest]["ip-address"] content[f"dest{i+1}-ip-mask"] = str(nodes[dest]["ip-mask"]) content[f"dest{i+1}-vlan-id"] = nodes[dest]["vlan-id"] controller_ip = get_device_with_driver() provisionamiento["actions"].append({ "type": "CONFIG_VPNL3", "layer": "IP", "content": content, "controller-uuid": "IP Controller" "controller_uuid": controller_ip }) config_rules.append(provisionamiento) Loading
src/pathcomp/frontend/service/TopologyTools.py +35 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import logging, math import logging, math, os, socket, requests from typing import Dict, Optional from common.Constants import DEFAULT_CONTEXT_NAME, DEFAULT_TOPOLOGY_NAME, ServiceNameEnum from common.Settings import ENVVAR_SUFIX_SERVICE_HOST, ENVVAR_SUFIX_SERVICE_PORT_GRPC, find_environment_variables, get_env_var_name Loading @@ -25,6 +25,7 @@ from common.tools.grpc.Tools import grpc_message_to_json_string from context.client.ContextClient import ContextClient from forecaster.client.ForecasterClient import ForecasterClient LOGGER = logging.getLogger(__name__) def get_service_schedule(service : Service) -> Optional[Constraint_Schedule]: Loading Loading @@ -96,3 +97,36 @@ def get_pathcomp_topology_details(request : PathCompRequest, allow_forecasting : link.attributes.total_capacity_gbps = total_capacity_gbps return topology_details # The HOST IP of the TFS controller is needed to query the devices and get the # IP address of the controller to be used in the path provisioning. ENVVAR_TFS_API_HOST = '10.95.89.50' def get_device_with_driver(driver_name: str = 'DEVICEDRIVER_IETF_L3VPN', timeout: int = 10): """Query the TFS controller REST API and return the _connect/address value of the first device with the given driver. Example: GET http://<vm-ip>/tfs-api/devices Returns the _connect/address string or None. """ url = f'http://{ENVVAR_TFS_API_HOST}:80/tfs-api/devices' try: logging.debug("Requesting devices from %s", url) resp = requests.get(url, timeout=timeout) resp.raise_for_status() data = resp.json() except Exception as e: logging.warning("Error fetching devices from %s: %s", url, e) return None devices = data.get('devices', []) if isinstance(data, dict) else [] for dev in devices: drivers = dev.get('device_drivers') or [] if isinstance(drivers, list) and driver_name in drivers: device_name = dev.get('name') return device_name logging.info("No device with driver %s found on %s", driver_name, url) return None