Commit cb1582cc authored by Pablo Armingol's avatar Pablo Armingol
Browse files

Code cleanup

parent 90ab9bc0
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -320,7 +320,6 @@ enum ServiceTypeEnum {
  SERVICETYPE_OPTICAL_CONNECTIVITY = 6;
  SERVICETYPE_QKD = 7;
  SERVICETYPE_IPLINK = 8;

}

enum ServiceStatusEnum {
+0 −2
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@
syntax = "proto3";
package ip_link;



message IpLinkRuleSet {
  string  ip   = 1;
  string  mask = 3;
+5 −22
Original line number Diff line number Diff line
@@ -280,9 +280,6 @@ def ufi_interface(resources, delete: bool): #Method used for configuring via
    for path, json_str in resources:
        key_value_data[path] = json_str

    # Iterate through the resources and extract parameter values dynamically

      
    # initialize the SSH client
    ssh_client = paramiko.SSHClient()
    ssh_client.load_system_host_keys()
@@ -291,10 +288,8 @@ def ufi_interface(resources, delete: bool): #Method used for configuring via

    try:
        ssh_client.connect(hostname='10.95.90.75', username='dnroot', password='dnroot', look_for_keys=False)
        #print("Connection successful")
        LOGGER.warning("Connection successful")
    except:
        #print("[!] Cannot connect to the SSH Server")
        LOGGER.warning("[!] Cannot connect to the SSH Server")
        exit()
    interface = 'ge100-0/0/3/1'  
@@ -318,9 +313,7 @@ def ufi_interface(resources, delete: bool): #Method used for configuring via
        channel.send('commit\n')
        time.sleep(1)

        # Capturar la salida del comando
        output = channel.recv(65535).decode('utf-8')
        #print(output)
        LOGGER.warning(output)
        # Close the SSH shell
        channel.close()
@@ -331,8 +324,6 @@ def ufi_interface(resources, delete: bool): #Method used for configuring via
    # Close the SSH client
    ssh_client.close()

    
    
def cisco_interface(resources, delete: bool, host: str, user: str, passw: str):     #Method used for configuring via CLI directly L2VPN in CISCO devices

    key_value_data = {}
@@ -340,9 +331,6 @@ def cisco_interface(resources, delete: bool, host: str, user: str, passw: str):
    for path, json_str in resources:
        key_value_data[path] = json_str

    # Iterate through the resources and extract parameter values dynamically

      
    # initialize the SSH client
    ssh_client = paramiko.SSHClient()
    ssh_client.load_system_host_keys()
@@ -351,10 +339,8 @@ def cisco_interface(resources, delete: bool, host: str, user: str, passw: str):

    try:
        ssh_client.connect(hostname='10.90.95.150', username='cisco', password='cisco123', look_for_keys=False)
        #print("Connection successful")
        LOGGER.warning("Connection successful")
    except:
        #print("[!] Cannot connect to the SSH Server")
        LOGGER.warning("[!] Cannot connect to the SSH Server")
        exit()
    interface = 'FourHundredGigE0/0/0/10.1212'  
@@ -378,10 +364,7 @@ def cisco_interface(resources, delete: bool, host: str, user: str, passw: str):
        channel.send('commit\n')
        time.sleep(0.1)


        # Capturar la salida del comando
        output = channel.recv(65535).decode('utf-8')
        #print(output)
        LOGGER.warning(output)
        # Close the SSH shell
        channel.close()
+11 −12
Original line number Diff line number Diff line
@@ -174,7 +174,6 @@ def compose_device_config_rules(

            endpoint_uuid = endpoint_id.endpoint_uuid.uuid
            LOGGER.debug('[compose_device_config_rules]   endpoint_uuid={:s}'.format(str(endpoint_uuid)))
            # given endpoint uuids link 'eth-1/0/20.533', remove last part after the '.'
            endpoint_uuid_or_name = (endpoint_uuid[::-1].split('.', maxsplit=1)[-1])[::-1]
            LOGGER.debug('[compose_device_config_rules]   endpoint_uuid_or_name={:s}'.format(str(endpoint_uuid_or_name)))
            endpoint_name_or_uuid_1 = endpoint_name_mapping[(device_uuid_or_name, endpoint_uuid_or_name)]
+0 −1
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ SERVICE_TYPE_LXNM = {ServiceTypeEnum.SERVICETYPE_L3NM, ServiceTypeEnum.SERVICE
SERVICE_TYPE_TAPI   = {ServiceTypeEnum.SERVICETYPE_TAPI_CONNECTIVITY_SERVICE}
SERVICE_TYPE_IPLINK = {ServiceTypeEnum.SERVICETYPE_IPLINK}


def get_service_type(device_type : DeviceTypeEnum, prv_service_type : ServiceTypeEnum) -> ServiceTypeEnum:
    if device_type in PACKET_DEVICE_TYPES and (prv_service_type in SERVICE_TYPE_LXNM or prv_service_type in SERVICE_TYPE_IPLINK ): return prv_service_type
    if device_type in L2_DEVICE_TYPES: return ServiceTypeEnum.SERVICETYPE_L2NM
Loading