- vendor: [str] Variable to set the name of the vendor of the device to be configured. Depending on the vendor, the generated template may vary.
- vlan_id: [int] Variable to set the value of the parameter "vlan id".
# Functionality:
This is an auxiliary method that helps in the creation of the Interface template. This method generates the correspondent configuration of the vlan for the interface.
The method first checks if the parameters vendor and vlan_id are defined. If the vendor is ADVA and vlan_id = 0, an special configuration line is created.
Based on the values of the given parameters, the method generates the vlan configuration string.
# Return:
[str] The method returns the generated vlan configuration string, that can be later used in the generation of the Interface template.
"""
defset_vlan(OptionalParams):#[L2/L3] Sets a VLANID and a VENDOR that will be requested for executing the following methods
verify=str(OptionalParams)#Verify transforms the received parameters into a string format for later making verifications and modifications
@@ -17,6 +31,19 @@ def set_vlan(OptionalParams): #[L2/L3] Sets a
else:vlan='</subinterface>\n </config>'
returnvlan
"""
# Method Name: set_ip
# Parameters:
- address_ip: [str] Variable that sets the value of the ip address.
- address_prefix: [int] Variable that specifies the prefix of the given ip address.
# Functionality:
This is an auxiliary method that helps in the creation of the Interface template. This method generates the correspondent configuration of the ip address for the interface.
The method first checks if the parameter address_ip is defined. If it is defined, then it creates the configuration string that will be used later in the Interface template.
# Return:
[str] The method returns the generated ip configuration string, that can be later used in the generation of the Interface template.
"""
defset_ip(OptionalParams):#[L3] Sets a IPAddress that will be requested for executing the following L3VPN methods
verify=str(OptionalParams)# Verify transforms the received parameters into a string format for later making verifications and modifications
@@ -29,6 +56,27 @@ def set_ip(OptionalParams): #[L3] Sets a
address='</subinterface>'
returnaddress
"""
# Method Name: create_If_SubIf
# Parameters:
- Interface_name: [str] Variable to set the name of the Interface that will be configured. [Mandatory parameter in all cases].
- DEL: [bool] Variable that determines if the template will be for creating (DEL = False) or for deleting (DEL = True) a configuration [Mandatory parameter in all cases].
- Interface_type: [str] Variable that specifies the type of interface, can take the value "l2vlan" or "l3ipvlan" [Only mandatory if DEL = False].
- SubInterface_Index: [int] Variable to set the index of the subinterface.[Only mandatory if DEL = False].
- Description: [str] Variable for adding a description to the Interface [Only mandatory if DEL = False].
# Functionality:
This method generates the template of an Interface with subinterface, used both for L2 and L3 VPNs.
This template will be generated for configuring a device, making use of pyangbind.
To generate the template the following steps are performed:
1) Checks if the DEL variable is true (Template for deleting a existent Interface or) or false (Template for creating a new Interface with Subinterface).
2) Create the template correspondent in each case, assigning the correspondent parameters with their value.
3) Make the correspondent replaces for the unssuported configurations by pyangbind.
# Return:
[str] The newly generated template according to the specified parameters.
"""
defcreate_If_SubIf(parameters):#[L2/L3] Creates a Interface with a Subinterface as described in /interface[{:s}]/subinterface[{:d}]
Interface_name=parameters['name']
DEL=parameters['DEL']# If the parameters DEL is set to "TRUE" that will mean that is for making a DELETE, ELSE is for creating
- NetInstance_name: [str] Variable to set the name of the Network Instance . [Mandatory parameter in all cases].
- DEL: [bool]Variable that determines if the template will be for creating (DEL = False) or for deleting (DEL = True) a configuration [Mandatory parameter in all cases].
- NetInstance_type: [str] Variable that sets the type of the Network Instance, it can take the value L2VSI for L2VPN or L3VRF for L3VPN .
- NetInstance_description [int] Variable for adding a description to the Network Instance .
- NetInstance_MTU [str] Variable that sets the value of the MTU for the network instance. [L2VPN]
- NetInstance_Route_disting [str] Variable to set the route distinguisher value . [L3VPN]
# Functionality:
This method generates the template for creating a Network Instance. This template will be generated for being configured in a device, making use of pyangbind.
To generate the template the following steps are performed:
1) Checks if the DEL variable is true (Template for deleting a existent Network Instance) or false (Template for creating a new Network Instance).
2) Create the template correspondent in each case, assigning the correspondent parameters with their value.
3) Make the correspondent replaces for the unssuported configurations by pyangbind.
# Return:
[str] The newly generated template according to the specified parameters.
"""
defcreate_network_instance(parameters,vendor):#[L2/L3] Creates a Network Instance as described in: /network_instance[{:s}]
NetInstance_name=parameters['name']#Retrieves the Name parameter of the NetInstance
DEL=parameters['DEL']#If the parameter DEL is set to "TRUE" that will mean that is for making a DELETE, ELSE is for creating
@@ -55,7 +76,7 @@ def create_network_instance(parameters,vendor): #[L2/L3] Creat
#Configuration for L3VRF
elif"L3VRF"inNetInstance_type:
NetInstance_Route_disting=parameters['route_distinguisher']#Retrieves the Route-Distinguisher parameter [Obligatory for L2VSI]
NetInstance_Route_disting=parameters['route_distinguisher']#Retrieves the Route-Distinguisher parameter [Obligatory for L3VRF]
#If the router-id parameter is defined [OPTIONAL-PARAMETER]
@@ -79,6 +100,24 @@ def create_network_instance(parameters,vendor): #[L2/L3] Creat
return (NetInstance_set)
"""
# Method Name: associate_If_to_NI
# Parameters:
- NetInstance_name: [str] Variable that specifies the name of Network Instance that is going to be used.
- NetInstance_ID: [str] Variable to set the ID of the Interface that is going to be associated to the Network Instance.
- NetInstance_Interface: [str] Variable that specifies the name of the Interface that is going to be associated to the Network Instance.
- NetInstance_SubInterface: [int] Variable that specifies the index of the subinterface that is going to be associated to the Network Instance.
# Functionality:
This method generates the template for associating an Interface to an existent Network Instance. This template will be generated for being configured in a device, making use of pyangbind.
To generate the template the following steps are performed:
1) Create the template correspondent in each case, assigning the correspondent parameters with their value.
2) Make the correspondent replaces for the unssuported configurations by pyangbind.
# Return:
[str] The newly generated template according to the specified parameters.
"""
defassociate_If_to_NI(parameters):#[L2/L3] Associates an Interface to a Network Instance as described in: /network_instance[{:s}]/interface[{:s}]
NetInstance_name=parameters['name']
NetInstance_ID=parameters['id']
@@ -103,6 +142,28 @@ def associate_If_to_NI(parameters): #[L2/L3] Associates a
- NetInstance_name: [str] Variable that specifies the name of Network Instance that is going to be used.
- DEL: [bool]Variable that determines if the template will be for creating (DEL = False) or for deleting (DEL = True) a configuration [Mandatory parameter in all cases].
- Protocol_name: [str] Variable that sets the type of protocol that is going to be added to the NI. It can be STATIC, DIRECTLY_CONNECTED or BGP.
- Identifier: [str] Variable that sets the identifier of the protocol that will be added to the NI. It can be STATIC, DIRECTLY_CONNECTED or BGP.
- AS: [int] Variable that specifies the AS (Autonomous System) parameter. To be defined only in case the protocol used is BGP
- Router_ID: [int] Variable that specifies the identifier of the router to be configured. To be defined only in case the protocol used is BGP
# Functionality:
This method generates the template that associates a routing protocol with a Network instance.
This template will be generated for being configured in a device, making use of pyangbind.
To generate the template the following steps are performed:
1) Checks if the DEL variable is true (Template for deleting a routing policy defined set) or false (Template for creating a routing policy defined set).
2) Create the template correspondent in each case, assigning the correspondent parameters with their value.
3) Make the correspondent replaces for the unssuported configurations by pyangbind.
# Return:
[str] The newly generated template according to the specified parameters.
"""
defadd_protocol_NI(parameters):#[L3] Adds a Protocol to a Network Instance as described in: /network_instance[{:s}]/protocols
NetInstance_name=parameters['name']
Protocol_name=parameters['protocol_name']#Protocol can be [STATIC], [DIRECTLY_CONNECTED] or [BGP]
@@ -161,6 +222,26 @@ def add_protocol_NI(parameters): #[L3] Adds a Proto
return (NetInstance_set)
"""
# Method Name: associate_virtual_circuit [Only for L2-VPN]
# Parameters:
- NetInstance_name: [str] Variable that specifies the name of Network Instance that is going to be used.
- ConnectionPoint_ID: [str] Variable that defines the Identifier of the Connection Point of within the Network Instance .
- VirtualCircuit_ID: [int] Variable that sets the Identifier of the Virtual Circuit (VC_ID).
- RemoteSystem: [str] Variable to specify the remote system (device) in which the virtual circuit is created. It should be an IP address.
# Functionality:
This method will generate the template to associate a virtual circuit, used for L2VPN, with a Network Instance.
This template will be generated for being configured in a device, making use of pyangbind.
To generate the template the following steps are performed:
1) Checks if the DEL variable is true (Template for deleting a Virtual Circuit from the NI) or false (Template for associating a Virtual Circuit to the NI).
2) Create the template correspondent in each case, assigning the correspondent parameters with their value.
3) Make the correspondent replaces for the unssuported configurations by pyangbind.
# Return:
[str] The newly generated template according to the specified parameters.
"""
defassociate_virtual_circuit(parameters):#[L2] Associates a Virtual Circuit as described in: /network_instance[{:s}]/connection_point[VC-1]
NetInstance_name=parameters['name']
ConnectionPoint_ID=parameters['connection_point']
@@ -188,6 +269,25 @@ def associate_virtual_circuit(parameters): #[L2] Associates a
# Method Name: associate_RP_to_NI [Only for L3-VPN]
# Parameters:
- NetInstance_name: [str] Variable that specifies the name of Network Instance that is going to be used.
- Import_policy: [str] Variable that specifies the name of the Import Routing Policy to be set.
- Export_policy: [str] Variable that specifies the name of the Export Routing Policy to be set.
# Functionality:
This method generates the template to associate a Routing Policy (Import or Export) to an existent Network Instance.
This template will be generated for being configured in a device, making use of pyangbind.
To generate the template the following steps are performed:
1) Checks if the DEL variable is true (Template for deleting a RP from a Network Instance) or false (Template for associating a RP to a Network Instance).
2) Create the template correspondent in each case, assigning the correspondent parameters with their value.
3) Make the correspondent replaces for the unssuported configurations by pyangbind.
# Return:
[str] The newly generated template according to the specified parameters.
"""
defassociate_RP_to_NI(parameters):#[L3] Associates a Routing Policy to a Network Instance as described in: /network_instance[{:s}]/inter_instance_policies[{:s}]
NetInstance_name=parameters['name']
verify=str(parameters)#Verify transforms the received parameters into a string format for later making verifications and modifications
@@ -217,6 +317,28 @@ def associate_RP_to_NI(parameters): #[L3] Associates a
# Method Name: create_table_conns [Only for L3-VPN]
# Parameters:
- NetInstance_name: [str] Variable that specifies the name of Network Instance that is going to be used.
- DEL: [bool] Variable that determines if the template will be for creating (DEL = False) or for deleting (DEL = True) a configuration [Mandatory parameter in all cases].
- SourceProtocol: [str] Variable to specify the protocol used in the Source for the table connection.
- DestProtocol [str] Variable to specify the protocol used in the Destination for the table connection..
- AddrFamily [str] Variable to specify the Address Family that is going to be used for the table connection. It can take the value 'IPV4'or 'IPV6'
- Def_ImportPolicy [str] Variable to specify a Routing Policy, that will be used as Default for the table connections.
# Functionality:
This method generates the template for creating (or deleting) a table connection.
This template will be generated for being configured in a device, making use of pyangbind.
To generate the template the following steps are performed:
1) Checks if the DEL variable is true (Template for deleting a table connection) or false (Template for creating a table connection).
2) Create the template correspondent in each case, assigning the correspondent parameters with their value.
3) Make the correspondent replaces for the unssuported configurations by pyangbind.
# Return:
[str] The newly generated template according to the specified parameters.
"""
defcreate_table_conns(parameters):#[L3] Creates Table Connections as described in: /network_instance[{:s}]/table_connections
- Policy_Name: [str] Variable that determines the name of the Routing Policy [Mandatory parameter in all cases].
- DEL: [bool] Variable that determines if the template will be for creating (DEL = False) or for deleting (DEL = True) a configuration [Mandatory parameter in all cases].
- Statement_Name: [str] Variable that determines the name of the Routing Policy Statement, which is a unique statement within the policy [Only mandatory if DEL = False].
- Policy_Result: [str] Variable to set if the policy is for accepting (ACCEPT ROUTE) or rejecting (REJECT ROUTE). [Only mandatory if DEL = False].
- ExtCommSetName: [str] Variable to set the name of the extended community set in the context of BGP policy conditions. [Only mandatory if DEL = False].
# Functionality:
This method generates the template of a routing policy statement to configure in a device, making use of pyangbind.
To generate the template the following steps are performed:
1) Checks if the DEL variable is true (Template for deleting a policy statement) or false (Template for creating a policy statement).
2) Create the template correspondent in each case, assigning the correspondent parameters with their value.
3) Make the correspondent replaces for the unssuported configurations by pyangbind.
# Return:
[str] The newly generated template according to the specified parameters.
"""
defcreate_rp_statement(parameters):#[L3] Creates a Routing Policy Statement
Policy_Name=parameters['policy_name']
DEL=parameters['DEL']#If the parameter DEL is set to "TRUE" that will mean that is for making a DELETE, ELSE is for creating
@@ -53,6 +73,25 @@ def create_rp_statement(parameters): #[L3] Creates a Routing
return (RoutingInstance_set)
"""
# Method Name: create_rp_def
# Parameters:
- ExtCommSetName: [str] Variable to set the name of the extended community set in the context of BGP policy conditions. [Mandatory parameter in all cases].
- DEL: [bool] Variable that determines if the template will be for creating (DEL = False) or for deleting (DEL = True) a configuration [Mandatory parameter in all cases].
- ExtCommMember: [str] Variable that represents an individual member or value within an Extended Community [Only mandatory if DEL = False].
# Functionality:
This method generates the template of a routing policy defined sets, which are objects defined and used within a routing policy statement.
This template will be generated for being configured in a device, making use of pyangbind.
To generate the template the following steps are performed:
1) Checks if the DEL variable is true (Template for deleting a routing policy defined set) or false (Template for creating a routing policy defined set).
2) Create the template correspondent in each case, assigning the correspondent parameters with their value.
3) Make the correspondent replaces for the unssuported configurations by pyangbind.
# Return:
[str] The newly generated template according to the specified parameters.
"""
defcreate_rp_def(parameters):#[L3] Creates a Routing Policy - Defined Sets [ '/routing_policy/bgp_defined_set[{:s}_rt_export][{:s}]' ]