Loading features/steps/NetconfLibrary.py +70 −0 Original line number Original line Diff line number Diff line Loading @@ -121,6 +121,76 @@ class NetconfLibrary: self.builtin.set_global_variable("${VLANS_ID}", vlans_id) self.builtin.set_global_variable("${VLANS_ID}", vlans_id) @keyword("the controller register the CVLAN ${cvid1} and ${cvid1} to the VLAN ${svid}") def register_CVLAN_in_SVLAN( self, cvid1: int, cvid2: int, svid: int ) -> None: """Deploy a S_VLAN in PEB mode and register two CVLAN """ for ne in self.network: 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) xml = create_VLAN_xml(ne,svid) m.edit_config(target="candidate", config=xml) m.commit() env = Environment( loader=FileSystemLoader("."), autoescape=False) context = { "cvid1":cvid1, "cvid2":cvid2, "port1_name" : ne.port_1 } xml = env.get_template("features/steps/svlan_2_registration_creation.xml.pyformat").render(context) m.edit_config(target="candidate", config=xml) m.commit() m.close_session() @keyword("the controller register the CVLAN ${cvid1} and ${cvid1} to the VLAN ${svid}") def register_CVLAN_in_SVLAN( self, cvid1: int, cvid2: int, svid: int ) -> None: """Deploy a S_VLAN in PEB mode and register two CVLAN """ for ne in self.network: 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) xml = create_VLAN_xml(ne,svid) m.edit_config(target="candidate", config=xml) m.commit() env = Environment( loader=FileSystemLoader("."), autoescape=False) context = { "cvid1":cvid1, "cvid2":cvid2, "svid" : svid, "port1_name" : ne.port_1 } xml = env.get_template("features/steps/svlan_2_registration_deletion.xml.pyformat").render(context) m.edit_config(target="candidate", config=xml) m.commit() m.close_session() @keyword("the controller unregister the CVLAN ${cvid1} and ${cvid1} to the VLAN ${svid}") def unregister_CVLAN_in_SVLAN( self, cvid1: int, cvid2: int, svid: int ) -> None: """Deploy a S_VLAN in PEB mode and register two CVLAN """ for ne in self.network: 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) xml = create_VLAN_xml(ne,svid) m.edit_config(target="candidate", config=xml) m.commit() env = Environment( loader=FileSystemLoader("."), autoescape=False) context = { "cvid1":cvid1, "cvid2":cvid2, "port1_name" : ne.port_1 } xml = env.get_template(vlan_delation_xml).render(context) m.edit_config(target="candidate", config=xml) m.commit() m.close_session() def connect_with_key(host, port, username, key_file): def connect_with_key(host, port, username, key_file): return manager.connect( return manager.connect( host=host, host=host, Loading features/steps/svlan_2_registration_deletion.xml.pyformat +13 −19 Original line number Original line Diff line number Diff line <?xml version="1.0"?> <?xml version="1.0"?> <nc:config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <bridges xmlns="urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"> <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <bridge> <interface> <name>{{ bridge_name }}</name> <name>{port1_name}</name> <component> <bridge-port xmlns="urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"> <name>{{ component_name }}</name> <cvid-registration xmlns="urn:ieee:std:802.1Q:yang:ieee802-dot1q-pb" nc:operation="delete"> <filtering-database> <cvid>{cvid1}</cvid> <vlan-registration-entry nc:operation="delete"> </cvid-registration> <database-id>1</database-id> <cvid-registration xmlns="urn:ieee:std:802.1Q:yang:ieee802-dot1q-pb" nc:operation="delete"> <vids>{{ svid }}</vids> <cvid>{cvid2}</cvid> </vlan-registration-entry> </cvid-registration> </filtering-database> </bridge-port> <bridge-vlan> </interface> <vlan nc:operation="delete"> </interfaces> <vid>{{ svid }}</vid> </vlan> </bridge-vlan> </component> </bridge> </bridges> </nc:config> </nc:config> Loading
features/steps/NetconfLibrary.py +70 −0 Original line number Original line Diff line number Diff line Loading @@ -121,6 +121,76 @@ class NetconfLibrary: self.builtin.set_global_variable("${VLANS_ID}", vlans_id) self.builtin.set_global_variable("${VLANS_ID}", vlans_id) @keyword("the controller register the CVLAN ${cvid1} and ${cvid1} to the VLAN ${svid}") def register_CVLAN_in_SVLAN( self, cvid1: int, cvid2: int, svid: int ) -> None: """Deploy a S_VLAN in PEB mode and register two CVLAN """ for ne in self.network: 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) xml = create_VLAN_xml(ne,svid) m.edit_config(target="candidate", config=xml) m.commit() env = Environment( loader=FileSystemLoader("."), autoescape=False) context = { "cvid1":cvid1, "cvid2":cvid2, "port1_name" : ne.port_1 } xml = env.get_template("features/steps/svlan_2_registration_creation.xml.pyformat").render(context) m.edit_config(target="candidate", config=xml) m.commit() m.close_session() @keyword("the controller register the CVLAN ${cvid1} and ${cvid1} to the VLAN ${svid}") def register_CVLAN_in_SVLAN( self, cvid1: int, cvid2: int, svid: int ) -> None: """Deploy a S_VLAN in PEB mode and register two CVLAN """ for ne in self.network: 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) xml = create_VLAN_xml(ne,svid) m.edit_config(target="candidate", config=xml) m.commit() env = Environment( loader=FileSystemLoader("."), autoescape=False) context = { "cvid1":cvid1, "cvid2":cvid2, "svid" : svid, "port1_name" : ne.port_1 } xml = env.get_template("features/steps/svlan_2_registration_deletion.xml.pyformat").render(context) m.edit_config(target="candidate", config=xml) m.commit() m.close_session() @keyword("the controller unregister the CVLAN ${cvid1} and ${cvid1} to the VLAN ${svid}") def unregister_CVLAN_in_SVLAN( self, cvid1: int, cvid2: int, svid: int ) -> None: """Deploy a S_VLAN in PEB mode and register two CVLAN """ for ne in self.network: 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) xml = create_VLAN_xml(ne,svid) m.edit_config(target="candidate", config=xml) m.commit() env = Environment( loader=FileSystemLoader("."), autoescape=False) context = { "cvid1":cvid1, "cvid2":cvid2, "port1_name" : ne.port_1 } xml = env.get_template(vlan_delation_xml).render(context) m.edit_config(target="candidate", config=xml) m.commit() m.close_session() def connect_with_key(host, port, username, key_file): def connect_with_key(host, port, username, key_file): return manager.connect( return manager.connect( host=host, host=host, Loading
features/steps/svlan_2_registration_deletion.xml.pyformat +13 −19 Original line number Original line Diff line number Diff line <?xml version="1.0"?> <?xml version="1.0"?> <nc:config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <nc:config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"> <bridges xmlns="urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"> <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <bridge> <interface> <name>{{ bridge_name }}</name> <name>{port1_name}</name> <component> <bridge-port xmlns="urn:ieee:std:802.1Q:yang:ieee802-dot1q-bridge"> <name>{{ component_name }}</name> <cvid-registration xmlns="urn:ieee:std:802.1Q:yang:ieee802-dot1q-pb" nc:operation="delete"> <filtering-database> <cvid>{cvid1}</cvid> <vlan-registration-entry nc:operation="delete"> </cvid-registration> <database-id>1</database-id> <cvid-registration xmlns="urn:ieee:std:802.1Q:yang:ieee802-dot1q-pb" nc:operation="delete"> <vids>{{ svid }}</vids> <cvid>{cvid2}</cvid> </vlan-registration-entry> </cvid-registration> </filtering-database> </bridge-port> <bridge-vlan> </interface> <vlan nc:operation="delete"> </interfaces> <vid>{{ svid }}</vid> </vlan> </bridge-vlan> </component> </bridge> </bridges> </nc:config> </nc:config>