Loading features/steps/NetconfLibrary.py +7 −4 Original line number Original line Diff line number Diff line Loading @@ -55,7 +55,9 @@ class NetconfLibrary: m = connect_with_key(ne.address, ne.mgmt_port, ne.username, ne.key_filename) m = connect_with_key(ne.address, ne.mgmt_port, ne.username, ne.key_filename) #m = connect_with_credentials(ne.address, ne.mgmt_port, ne.username, ne.password) #m = connect_with_credentials(ne.address, ne.mgmt_port, ne.username, ne.password) BuiltIn().log_to_console("connected to device") BuiltIn().log_to_console("connected to device") xml = create_VLAN_xml(ne,vlan_id) xml = create_VLAN_xml(ne,vlan_id, "tagged") if ne.edgeIface != None: xml = create_VLAN_xml(ne,vlan_id, "untagged") target = "candidate" target = "candidate" m.edit_config(target=target, config=xml) m.edit_config(target=target, config=xml) m.commit() m.commit() Loading Loading @@ -114,7 +116,7 @@ class NetconfLibrary: for ne in self.network: for ne in self.network: m = connect_with_key(ne.address, ne.mgmt_port, ne.username, ne.key_filename) m = connect_with_key(ne.address, ne.mgmt_port, ne.username, ne.key_filename) #m = connect_with_credentials(ne.address, ne.mgmt_port, ne.username, ne.password) #m = connect_with_credentials(ne.address, ne.mgmt_port, ne.username, ne.password) xml = create_VLAN_xml(ne,vlan_id) xml = create_VLAN_xml(ne,vlan_id, "tagged") m.edit_config(target="candidate", config=xml) m.edit_config(target="candidate", config=xml) m.commit() m.commit() m.close_session() m.close_session() Loading Loading @@ -189,7 +191,7 @@ def connect_with_credentials(host, port, username, password): look_for_keys=False look_for_keys=False ) ) def create_VLAN_xml(ne, vlanID): def create_VLAN_xml(ne, vlanID, tag): env = Environment( loader=FileSystemLoader("."), autoescape=False) env = Environment( loader=FileSystemLoader("."), autoescape=False) context = { context = { "vid":vlanID, "vid":vlanID, Loading @@ -197,7 +199,8 @@ def create_VLAN_xml(ne, vlanID): "component_name" : ne.componentName, "component_name" : ne.componentName, "vlan_name" : "TestVLAN", "vlan_name" : "TestVLAN", "port1_portref": ne.port_1, "port1_portref": ne.port_1, "port2_portref" : ne.port_2 "port2_portref" : ne.port_2, "tagged" : tag } } return env.get_template(vlan_creation_xml).render(context) return env.get_template(vlan_creation_xml).render(context) Loading features/steps/cvlan_creation.xml.pyformat +1 −1 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,7 @@ <dot1q:port-ref>{{ port1_portref }}</dot1q:port-ref> <dot1q:port-ref>{{ port1_portref }}</dot1q:port-ref> <dot1q:static-vlan-registration-entries> <dot1q:static-vlan-registration-entries> <dot1q:registrar-admin-control>fixed-new-ignored</dot1q:registrar-admin-control> <dot1q:registrar-admin-control>fixed-new-ignored</dot1q:registrar-admin-control> <dot1q:vlan-transmitted>tagged</dot1q:vlan-transmitted> <dot1q:vlan-transmitted>{{ tagged }}</dot1q:vlan-transmitted> </dot1q:static-vlan-registration-entries> </dot1q:static-vlan-registration-entries> </dot1q:port-map> </dot1q:port-map> <dot1q:port-map> <dot1q:port-map> Loading Loading
features/steps/NetconfLibrary.py +7 −4 Original line number Original line Diff line number Diff line Loading @@ -55,7 +55,9 @@ class NetconfLibrary: m = connect_with_key(ne.address, ne.mgmt_port, ne.username, ne.key_filename) m = connect_with_key(ne.address, ne.mgmt_port, ne.username, ne.key_filename) #m = connect_with_credentials(ne.address, ne.mgmt_port, ne.username, ne.password) #m = connect_with_credentials(ne.address, ne.mgmt_port, ne.username, ne.password) BuiltIn().log_to_console("connected to device") BuiltIn().log_to_console("connected to device") xml = create_VLAN_xml(ne,vlan_id) xml = create_VLAN_xml(ne,vlan_id, "tagged") if ne.edgeIface != None: xml = create_VLAN_xml(ne,vlan_id, "untagged") target = "candidate" target = "candidate" m.edit_config(target=target, config=xml) m.edit_config(target=target, config=xml) m.commit() m.commit() Loading Loading @@ -114,7 +116,7 @@ class NetconfLibrary: for ne in self.network: for ne in self.network: m = connect_with_key(ne.address, ne.mgmt_port, ne.username, ne.key_filename) m = connect_with_key(ne.address, ne.mgmt_port, ne.username, ne.key_filename) #m = connect_with_credentials(ne.address, ne.mgmt_port, ne.username, ne.password) #m = connect_with_credentials(ne.address, ne.mgmt_port, ne.username, ne.password) xml = create_VLAN_xml(ne,vlan_id) xml = create_VLAN_xml(ne,vlan_id, "tagged") m.edit_config(target="candidate", config=xml) m.edit_config(target="candidate", config=xml) m.commit() m.commit() m.close_session() m.close_session() Loading Loading @@ -189,7 +191,7 @@ def connect_with_credentials(host, port, username, password): look_for_keys=False look_for_keys=False ) ) def create_VLAN_xml(ne, vlanID): def create_VLAN_xml(ne, vlanID, tag): env = Environment( loader=FileSystemLoader("."), autoescape=False) env = Environment( loader=FileSystemLoader("."), autoescape=False) context = { context = { "vid":vlanID, "vid":vlanID, Loading @@ -197,7 +199,8 @@ def create_VLAN_xml(ne, vlanID): "component_name" : ne.componentName, "component_name" : ne.componentName, "vlan_name" : "TestVLAN", "vlan_name" : "TestVLAN", "port1_portref": ne.port_1, "port1_portref": ne.port_1, "port2_portref" : ne.port_2 "port2_portref" : ne.port_2, "tagged" : tag } } return env.get_template(vlan_creation_xml).render(context) return env.get_template(vlan_creation_xml).render(context) Loading
features/steps/cvlan_creation.xml.pyformat +1 −1 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,7 @@ <dot1q:port-ref>{{ port1_portref }}</dot1q:port-ref> <dot1q:port-ref>{{ port1_portref }}</dot1q:port-ref> <dot1q:static-vlan-registration-entries> <dot1q:static-vlan-registration-entries> <dot1q:registrar-admin-control>fixed-new-ignored</dot1q:registrar-admin-control> <dot1q:registrar-admin-control>fixed-new-ignored</dot1q:registrar-admin-control> <dot1q:vlan-transmitted>tagged</dot1q:vlan-transmitted> <dot1q:vlan-transmitted>{{ tagged }}</dot1q:vlan-transmitted> </dot1q:static-vlan-registration-entries> </dot1q:static-vlan-registration-entries> </dot1q:port-map> </dot1q:port-map> <dot1q:port-map> <dot1q:port-map> Loading