Loading src/device/service/drivers/oc_driver/OCDriver.py +4 −3 Original line number Diff line number Diff line Loading @@ -28,9 +28,9 @@ from device.service.driver_api._Driver import _Driver from .templates import compose_config, cli_compose_config, ufi_interface, cisco_interface from .templates.VPN.common import seperate_port_config from .templates.VPN.roadms import ( create_optical_band, disable_media_channel, delete_optical_band, create_media_channel create_optical_band, disable_media_channel, delete_optical_band, create_media_channel, ) from .templates.VPN.transponder import edit_optical_channel, change_optical_channel_status from .templates.VPN.transponder import edit_optical_channel, change_optical_channel_status, disable_optical_channel from .RetryDecorator import retry from context.client.ContextClient import ContextClient from common.proto.context_pb2 import OpticalConfig Loading Loading @@ -177,7 +177,8 @@ def edit_config( # Device type is Transponder if (conditions['edit_type'] == "optical-channel"): _,ports,_=seperate_port_config(resources) str_config_messages=change_optical_channel_status(state="DISABLED",ports=ports) #str_config_messages=change_optical_channel_status(state="DISABLED",ports=ports) str_config_messages=disable_optical_channel(ports=ports) # Device type is Roadm elif (conditions['edit_type']=='optical-band'): Loading src/device/service/drivers/oc_driver/templates/VPN/transponder.py +44 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,49 @@ def create_optical_channel(resources:list[dict],ports:list[dict],config:list[dic return results def disable_optical_channel(ports:list[dict] ): # unwanted_keys=['bidir','source_port','destination_port','handled_flow','name','channel_namespace','admin-state' # ,'optical-band-parent'] results =[] port_val = "" if 'destination_port' in ports and ports['destination_port'][0] is not None: port_val = ports['destination_port'][0] else: port_val = ports['source_port'][0] doc, tag, text = Doc().tagtext() #with tag('config'): with tag('config',xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"): with tag('components', xmlns="http://openconfig.net/yang/platform"): with tag('component'): with tag('name'):text("channel-{}".format(port_val)) with tag('config'): with tag('name'):text("channel-{}".format(port_val)) with tag('optical-channel',xmlns="http://openconfig.net/yang/terminal-device"): with tag('config'): with tag('frequency'):text('199000000') with tag('target-output-power'):text('-40') with tag('operational-mode'):text('0') with tag('terminal-device', xmlns="http://openconfig.net/yang/terminal-device"): with tag('logical-channels'): with tag('channel'): with tag('index'):text("{}".format(port_val)) with tag('config'): with tag('index'):text("{}".format(port_val)) with tag('admin-state'):text("DISABLED") result = indent( doc.getvalue(), indentation = ' '*2, newline = '' ) results.append(result) return results def change_optical_channel_status (state:str,ports:list[dict]) : port_val="" if 'destination_port' in ports and ports['destination_port'][0] is not None: Loading Loading @@ -139,6 +182,7 @@ def change_optical_channel_status (state:str,ports:list[dict]) : return results def edit_optical_channel (resources:list[dict]): unwanted_keys=['destination_port','source_port','channel_namespace' Loading src/device/service/drivers/oc_driver/templates/discovery_tool/transponders.py +19 −2 Original line number Diff line number Diff line Loading @@ -108,6 +108,9 @@ def extract_channels_based_on_channelnamespace (xml_data:str,channel_namespace:s # Extract and print the component names for component in component_names: component_name = component.find('namespace:name', namespace).text #fix for ofc2025 demo with HHI transceiver #if "transceiver" not in component_name and "port" not in component_name: if "channel" in component_name: channels.append({"index":component_name}) else : namespaces = { Loading Loading @@ -305,6 +308,7 @@ def extract_ports_based_on_type (xml_data:str): root = ET.fromstring(xml_bytes) namespace = {'oc': 'http://openconfig.net/yang/platform', 'typex': 'http://openconfig.net/yang/platform-types'} ports = [] ''' components = root.findall(".//oc:state[oc:type]",namespace) for component in components: type_ele = component.find(".//oc:type",namespace) Loading @@ -315,6 +319,18 @@ def extract_ports_based_on_type (xml_data:str): port_index=name_element.text.split("-")[1] port = (port_name,port_index) ports.append(port) ''' optical_channel_namespaces = { 'ns': 'urn:ietf:params:xml:ns:netconf:base:1.0', 'oc': 'http://openconfig.net/yang/platform', } components = root.findall('.//oc:component',namespaces=optical_channel_namespaces) for component in components: name=component.find('.//oc:name',optical_channel_namespaces).text if "port" in name: port_index=name.split("-")[1] port = (name,port_index) ports.append(port) return ports def transponder_values_extractor(data_xml:str,resource_keys:list,dic:dict): Loading @@ -327,6 +343,7 @@ def transponder_values_extractor(data_xml:str,resource_keys:list,dic:dict): channel_names= extract_channels_based_on_channelnamespace(xml_data=data_xml,channel_namespace=channel_namespace,is_opticalband=is_opticalband) ports = extract_ports_based_on_type(data_xml) logging.info(f"OFC25---- {channel_names}, {ports}") optical_channels_params=[] ports_result=[] interfaces=[] Loading src/service/service/ServiceServiceServicerImpl.py +4 −1 Original line number Diff line number Diff line Loading @@ -276,6 +276,9 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): ports = [] for endpoint_id in service.service_endpoint_ids: endpoint_device_uuid = endpoint_id.device_id.device_uuid.uuid if "." in endpoint_device_uuid: endpoint_device_name = endpoint_device_uuid else: endpoint_device_name = device_names[endpoint_device_uuid] devs.append(endpoint_device_name) ports.append(endpoint_id.endpoint_uuid.uuid) Loading Loading
src/device/service/drivers/oc_driver/OCDriver.py +4 −3 Original line number Diff line number Diff line Loading @@ -28,9 +28,9 @@ from device.service.driver_api._Driver import _Driver from .templates import compose_config, cli_compose_config, ufi_interface, cisco_interface from .templates.VPN.common import seperate_port_config from .templates.VPN.roadms import ( create_optical_band, disable_media_channel, delete_optical_band, create_media_channel create_optical_band, disable_media_channel, delete_optical_band, create_media_channel, ) from .templates.VPN.transponder import edit_optical_channel, change_optical_channel_status from .templates.VPN.transponder import edit_optical_channel, change_optical_channel_status, disable_optical_channel from .RetryDecorator import retry from context.client.ContextClient import ContextClient from common.proto.context_pb2 import OpticalConfig Loading Loading @@ -177,7 +177,8 @@ def edit_config( # Device type is Transponder if (conditions['edit_type'] == "optical-channel"): _,ports,_=seperate_port_config(resources) str_config_messages=change_optical_channel_status(state="DISABLED",ports=ports) #str_config_messages=change_optical_channel_status(state="DISABLED",ports=ports) str_config_messages=disable_optical_channel(ports=ports) # Device type is Roadm elif (conditions['edit_type']=='optical-band'): Loading
src/device/service/drivers/oc_driver/templates/VPN/transponder.py +44 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,49 @@ def create_optical_channel(resources:list[dict],ports:list[dict],config:list[dic return results def disable_optical_channel(ports:list[dict] ): # unwanted_keys=['bidir','source_port','destination_port','handled_flow','name','channel_namespace','admin-state' # ,'optical-band-parent'] results =[] port_val = "" if 'destination_port' in ports and ports['destination_port'][0] is not None: port_val = ports['destination_port'][0] else: port_val = ports['source_port'][0] doc, tag, text = Doc().tagtext() #with tag('config'): with tag('config',xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"): with tag('components', xmlns="http://openconfig.net/yang/platform"): with tag('component'): with tag('name'):text("channel-{}".format(port_val)) with tag('config'): with tag('name'):text("channel-{}".format(port_val)) with tag('optical-channel',xmlns="http://openconfig.net/yang/terminal-device"): with tag('config'): with tag('frequency'):text('199000000') with tag('target-output-power'):text('-40') with tag('operational-mode'):text('0') with tag('terminal-device', xmlns="http://openconfig.net/yang/terminal-device"): with tag('logical-channels'): with tag('channel'): with tag('index'):text("{}".format(port_val)) with tag('config'): with tag('index'):text("{}".format(port_val)) with tag('admin-state'):text("DISABLED") result = indent( doc.getvalue(), indentation = ' '*2, newline = '' ) results.append(result) return results def change_optical_channel_status (state:str,ports:list[dict]) : port_val="" if 'destination_port' in ports and ports['destination_port'][0] is not None: Loading Loading @@ -139,6 +182,7 @@ def change_optical_channel_status (state:str,ports:list[dict]) : return results def edit_optical_channel (resources:list[dict]): unwanted_keys=['destination_port','source_port','channel_namespace' Loading
src/device/service/drivers/oc_driver/templates/discovery_tool/transponders.py +19 −2 Original line number Diff line number Diff line Loading @@ -108,6 +108,9 @@ def extract_channels_based_on_channelnamespace (xml_data:str,channel_namespace:s # Extract and print the component names for component in component_names: component_name = component.find('namespace:name', namespace).text #fix for ofc2025 demo with HHI transceiver #if "transceiver" not in component_name and "port" not in component_name: if "channel" in component_name: channels.append({"index":component_name}) else : namespaces = { Loading Loading @@ -305,6 +308,7 @@ def extract_ports_based_on_type (xml_data:str): root = ET.fromstring(xml_bytes) namespace = {'oc': 'http://openconfig.net/yang/platform', 'typex': 'http://openconfig.net/yang/platform-types'} ports = [] ''' components = root.findall(".//oc:state[oc:type]",namespace) for component in components: type_ele = component.find(".//oc:type",namespace) Loading @@ -315,6 +319,18 @@ def extract_ports_based_on_type (xml_data:str): port_index=name_element.text.split("-")[1] port = (port_name,port_index) ports.append(port) ''' optical_channel_namespaces = { 'ns': 'urn:ietf:params:xml:ns:netconf:base:1.0', 'oc': 'http://openconfig.net/yang/platform', } components = root.findall('.//oc:component',namespaces=optical_channel_namespaces) for component in components: name=component.find('.//oc:name',optical_channel_namespaces).text if "port" in name: port_index=name.split("-")[1] port = (name,port_index) ports.append(port) return ports def transponder_values_extractor(data_xml:str,resource_keys:list,dic:dict): Loading @@ -327,6 +343,7 @@ def transponder_values_extractor(data_xml:str,resource_keys:list,dic:dict): channel_names= extract_channels_based_on_channelnamespace(xml_data=data_xml,channel_namespace=channel_namespace,is_opticalband=is_opticalband) ports = extract_ports_based_on_type(data_xml) logging.info(f"OFC25---- {channel_names}, {ports}") optical_channels_params=[] ports_result=[] interfaces=[] Loading
src/service/service/ServiceServiceServicerImpl.py +4 −1 Original line number Diff line number Diff line Loading @@ -276,6 +276,9 @@ class ServiceServiceServicerImpl(ServiceServiceServicer): ports = [] for endpoint_id in service.service_endpoint_ids: endpoint_device_uuid = endpoint_id.device_id.device_uuid.uuid if "." in endpoint_device_uuid: endpoint_device_name = endpoint_device_uuid else: endpoint_device_name = device_names[endpoint_device_uuid] devs.append(endpoint_device_name) ports.append(endpoint_id.endpoint_uuid.uuid) Loading