Skip to content
Snippets Groups Projects
Commit 8a29bd6a authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Service component - L3NM OpenConfig:

- Cosmetic changes
parent e5a05ea8
No related branches found
No related tags found
2 merge requests!294Release TeraFlowSDN 4.0,!196Resolve "(CTTC) Incorrect endpoint lookup in NBI ETSI BWM plugin"
......@@ -18,7 +18,7 @@ from service.service.service_handler_api.AnyTreeTools import TreeNode
def setup_config_rules(
service_uuid : str, connection_uuid : str, device_uuid : str, endpoint_uuid : str, endpoint_name : str,
service_settings : TreeNode, endpoint_settings : TreeNode, endpoint_acls : List [Tuple], device_settings: TreeNode
service_settings : TreeNode, device_settings : TreeNode, endpoint_settings : TreeNode, endpoint_acls : List [Tuple]
) -> List[Dict]:
if service_settings is None: return []
......@@ -60,13 +60,13 @@ def setup_config_rules(
if_subif_name = '{:s}'.format(endpoint_name[5:])
json_config_rules = [
# # Configure Interface (not used)
# json_config_rule_set(
# Configure Interface (not used)
#json_config_rule_set(
# '/interface[{:s}]'.format(endpoint_name), {
# 'name': endpoint_name,
# 'description': network_interface_desc,
# 'mtu': mtu,
# }),
#}),
#Create network instance
json_config_rule_set(
......@@ -98,7 +98,7 @@ def setup_config_rules(
'identifier': 'DIRECTLY_CONNECTED',
'protocol_name': 'DIRECTLY_CONNECTED',
}),
#Add STATIC protocol to network instance
json_config_rule_set(
'/network_instance[{:s}]/protocols[STATIC]'.format(network_instance_name), {
......@@ -229,7 +229,7 @@ def setup_config_rules(
def teardown_config_rules(
service_uuid : str, connection_uuid : str, device_uuid : str, endpoint_uuid : str, endpoint_name : str,
service_settings : TreeNode, endpoint_settings : TreeNode, device_settings: TreeNode
service_settings : TreeNode, device_settings : TreeNode, endpoint_settings : TreeNode
) -> List[Dict]:
if service_settings is None: return []
......@@ -247,17 +247,17 @@ def teardown_config_rules(
# network_subinterface_desc = '{:s}-NetSubIf'.format(service_uuid)
network_subinterface_desc = ''
mtu = json_settings.get('mtu', 1450 ) # 1512
#address_families = json_settings.get('address_families', [] ) # ['IPV4']
bgp_as = json_device_settings.get('bgp_as', 65000 ) # 65000
route_distinguisher = json_device_settings.get('route_distinguisher', '0:0' ) # '60001:801'
sub_interface_index = json_endpoint_settings.get('sub_interface_index', 0 ) # 1
router_id = json_device_settings.get('router_id', '0.0.0.0') # '10.95.0.10'
vlan_id = json_endpoint_settings.get('vlan_id', 1 ) # 400
address_ip = json_endpoint_settings.get('address_ip', '0.0.0.0') # '2.2.2.1'
address_prefix = json_endpoint_settings.get('address_prefix', 24 ) # 30
policy_import = json_device_settings.get('policy_AZ', '2' ) # 2
policy_export = json_device_settings.get('policy_ZA', '7' ) # 30
mtu = json_settings.get('mtu', 1450 ) # 1512
#address_families = json_settings.get('address_families', [] ) # ['IPV4']
#bgp_as = json_device_settings.get('bgp_as', 65000 ) # 65000
route_distinguisher = json_device_settings.get('route_distinguisher', '0:0' ) # '60001:801'
sub_interface_index = json_endpoint_settings.get('sub_interface_index', 0 ) # 1
#router_id = json_device_settings.get('router_id', '0.0.0.0') # '10.95.0.10'
vlan_id = json_endpoint_settings.get('vlan_id', 1 ) # 400
address_ip = json_endpoint_settings.get('address_ip', '0.0.0.0') # '2.2.2.1'
address_prefix = json_endpoint_settings.get('address_prefix', 24 ) # 30
policy_import = json_device_settings.get('policy_AZ', '2' ) # 2
policy_export = json_device_settings.get('policy_ZA', '7' ) # 30
self_bgp_if_name = json_device_settings.get('self_bgp_interface_name', '')
self_bgp_address_ip = json_device_settings.get('self_bgp_interface_address_ip', '')
......@@ -282,6 +282,7 @@ def teardown_config_rules(
'ext_community_set_name': 'set_{:s}'.format(policy_export),
'ext_community_member' : route_distinguisher,
}),
#Delete import routing policy
json_config_rule_delete(
# pylint: disable=duplicate-string-formatting-argument
......@@ -296,6 +297,7 @@ def teardown_config_rules(
'ext_community_set_name': 'set_{:s}'.format(policy_import),
'ext_community_member' : route_distinguisher,
}),
#Delete interface; automatically deletes:
# - /interface[]/subinterface[]
# json_config_rule_delete('/interface[{:s}]/subinterface[0]'.format(if_subif_name),
......
......@@ -60,7 +60,7 @@ class L3NMOpenConfigServiceHandler(_ServiceHandler):
json_config_rules = setup_config_rules(
service_uuid, connection_uuid, device_uuid, endpoint_uuid, endpoint_name,
settings, endpoint_settings, endpoint_acls, device_settings)
settings, device_settings, endpoint_settings, endpoint_acls)
if len(json_config_rules) > 0:
del device_obj.device_config.config_rules[:]
......@@ -98,7 +98,7 @@ class L3NMOpenConfigServiceHandler(_ServiceHandler):
json_config_rules = teardown_config_rules(
service_uuid, connection_uuid, device_uuid, endpoint_uuid, endpoint_name,
settings, endpoint_settings, device_settings)
settings, device_settings, endpoint_settings)
if len(json_config_rules) > 0:
del device_obj.device_config.config_rules[:]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment