def test_static_routing_uncfg(self): Genie.testbed = testbed = Testbed() dev1 = Device(testbed=testbed, name='PE1', os='iosxr') static_routing = StaticRouting() static_routing.vrf = 'VRF1' static_routing.af = 'ipv4' static_routing.route = '{}'.format('10.2.1.0/24') static_routing.device_attr[dev1].vrf_attr[ static_routing.vrf].address_family_attr[ static_routing.af].route_attr[ static_routing.route].next_hop_attr[None] dev1.add_feature(static_routing) un_cfgs = static_routing.build_unconfig(apply=False) self.assertCountEqual(un_cfgs.keys(), [dev1.name]) self.maxDiff = None self.assertMultiLineEqual( str(un_cfgs[dev1.name]), '\n'.join([ 'router static', ' vrf VRF1', ' address-family ipv4 unicast', ' no 10.2.1.0/24', ' exit', ' exit', ' exit', ]))
def test_static_routing_uncfg(self): Genie.testbed = testbed = Testbed() dev1 = Device(testbed=testbed, name='PE1', os='iosxe') static_routing_2 = StaticRouting() static_routing_2.device_attr[dev1].vrf_attr[ 'default'].address_family_attr['ipv4'].route_attr[ '10.2.1.0/24'].next_hop_attr['18.0.1.1'] dev1.add_feature(static_routing_2) un_cfgs = static_routing_2.build_unconfig(apply=False) self.assertCountEqual(un_cfgs.keys(), [dev1.name]) self.maxDiff = None self.assertEqual( str(un_cfgs[dev1.name]), '\n'.join(['no ip route 10.2.1.0 255.255.255.0 18.0.1.1']))
def test_static_routing_default_uncfg(self): Genie.testbed = testbed = Testbed() dev1 = Device(testbed=testbed, name='PE1', os='nxos') static_routing = StaticRouting() static_routing.af = 'ipv4' static_routing.interface = 'Ethernet0/1' static_routing.route = '10.2.1.0/24' static_routing.device_attr[dev1].vrf_attr['default'].address_family_attr[static_routing.af].route_attr[ static_routing.route].interface_attr[static_routing.interface].if_nexthop = '192.168.2.2' dev1.add_feature(static_routing) un_cfgs = static_routing.build_unconfig(apply=False) self.assertCountEqual(un_cfgs.keys(), [dev1.name]) self.maxDiff = None self.assertEqual(str(un_cfgs[dev1.name]), '\n'.join( ['no ip route 10.2.1.0/24 Ethernet0/1 192.168.2.2', ]))