Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_x3_config_from_ldp_job(self):
acl1 = AccessList(name='acl1')
acl2 = AccessList(name='acl2')
acl3 = AccessList(name='acl3')
acl4 = AccessList(name='acl4')
acl5 = AccessList(name='acl5')
acl6 = AccessList(name='acl6')
acl7 = AccessList(name='acl7')
acl8 = AccessList(name='acl8')
acl9 = AccessList(name='acl9')
acl11 = AccessList(name='acl11')
acl22 = AccessList(name='acl22')
acl33 = AccessList(name='acl33')
acl44 = AccessList(name='acl44')
acl1111 = AccessList(name='acl1111')
acl2222 = AccessList(name='acl2222')
acl3333 = AccessList(name='acl3333')
acl4444 = AccessList(name='acl4444')
ldp = Ldp()
self.link.add_feature(ldp)
self.link2.add_feature(ldp)
self.link3.add_feature(ldp)
self.link4.add_feature(ldp)
ldp.device_attr['PE1'].router_id = '1.1.1.1'
def test_1_top_level(self):
acl1 = AccessList(name='acl1')
acl2 = AccessList(name='acl2')
acl3 = AccessList(name='acl3')
acl4 = AccessList(name='acl4')
acl5 = AccessList(name='acl5')
acl6 = AccessList(name='acl6')
acl7 = AccessList(name='acl7')
acl8 = AccessList(name='acl8')
acl9 = AccessList(name='acl9')
acl11 = AccessList(name='acl11')
acl22 = AccessList(name='acl22')
acl33 = AccessList(name='acl33')
acl44 = AccessList(name='acl44')
acl1111 = AccessList(name='acl1111')
acl2222 = AccessList(name='acl2222')
acl3333 = AccessList(name='acl3333')
acl4444 = AccessList(name='acl4444')
ldp = Ldp()
self.link.add_feature(ldp)
# ==Test top-level config==
ldp.capabilities_cisco_iosxr = False
ldp.default_vrf_impl_ipv4 = False
acl2 = AccessList(name='acl2')
acl3 = AccessList(name='acl3')
acl4 = AccessList(name='acl4')
acl5 = AccessList(name='acl5')
acl6 = AccessList(name='acl6')
acl7 = AccessList(name='acl7')
acl8 = AccessList(name='acl8')
acl9 = AccessList(name='acl9')
acl11 = AccessList(name='acl11')
acl22 = AccessList(name='acl22')
acl33 = AccessList(name='acl33')
acl44 = AccessList(name='acl44')
acl1111 = AccessList(name='acl1111')
acl2222 = AccessList(name='acl2222')
acl3333 = AccessList(name='acl3333')
acl4444 = AccessList(name='acl4444')
nbr1 = IPv4LsrNeighbor('1.2.3.5:0')
nbr2 = IPv4LsrNeighbor('1.2.3.6:0')
nbr3 = IPv4LsrNeighbor('1.2.3.7:0')
nbr4 = IPv4LsrNeighbor('1.2.3.8:0')
ldp = Ldp()
self.link.add_feature(ldp)
vrf = Vrf(name='vrf1')
ldp.add_force_vrf(vrf)
ldp.device_attr['PE1'].vrf_attr['vrf1'].address_family_attr['ipv4'].neighbors = [nbr1, nbr2, nbr3, nbr4]
ldp.device_attr['PE1'].vrf_attr['vrf1'].address_family_attr['ipv4'].neighbor_attr['1.2.3.5:0'].advertise_for_acl = acl1
ldp.device_attr['PE1'].vrf_attr['vrf1'].address_family_attr['ipv4'].neighbor_attr['1.2.3.6:0'].advertise_for_acl = acl2
ldp.device_attr['PE1'].vrf_attr['vrf1'].address_family_attr['ipv4'].neighbor_attr['1.2.3.7:0'].accept_for_acl = acl1
ldp.device_attr['PE1'].vrf_attr['vrf1'].address_family_attr['ipv4'].neighbor_attr['1.2.3.8:0'].accept_for_acl = acl2
def test_9_per_af_per_neighbor(self):
acl1 = AccessList(name='acl1')
acl2 = AccessList(name='acl2')
acl3 = AccessList(name='acl3')
acl4 = AccessList(name='acl4')
acl5 = AccessList(name='acl5')
acl6 = AccessList(name='acl6')
acl7 = AccessList(name='acl7')
acl8 = AccessList(name='acl8')
acl9 = AccessList(name='acl9')
acl11 = AccessList(name='acl11')
acl22 = AccessList(name='acl22')
acl33 = AccessList(name='acl33')
acl44 = AccessList(name='acl44')
acl1111 = AccessList(name='acl1111')
acl2222 = AccessList(name='acl2222')
acl3333 = AccessList(name='acl3333')
acl4444 = AccessList(name='acl4444')
nbr1 = IPv4LsrNeighbor('1.2.3.4:0')
nbr2 = IPv4LsrNeighbor('1.2.3.5:0')
nbr3 = IPv4LsrNeighbor('1.2.3.6:0')
nbr4 = IPv4LsrNeighbor('1.2.3.7:0')
nbr5 = IPv4LsrNeighbor('1.2.3.8:0')
nbr6 = IPv6Neighbor('1:2::3')
nbr7 = IPv6Neighbor('1:2::4')
nbr8 = IPv6Neighbor('1:2::5')
ldp = Ldp()
def test_8_per_vrf_per_neighbor(self):
acl1 = AccessList(name='acl1')
acl2 = AccessList(name='acl2')
acl3 = AccessList(name='acl3')
acl4 = AccessList(name='acl4')
acl5 = AccessList(name='acl5')
acl6 = AccessList(name='acl6')
acl7 = AccessList(name='acl7')
acl8 = AccessList(name='acl8')
acl9 = AccessList(name='acl9')
acl11 = AccessList(name='acl11')
acl22 = AccessList(name='acl22')
acl33 = AccessList(name='acl33')
acl44 = AccessList(name='acl44')
acl1111 = AccessList(name='acl1111')
acl2222 = AccessList(name='acl2222')
acl3333 = AccessList(name='acl3333')
acl4444 = AccessList(name='acl4444')
ldp = Ldp()
self.link.add_feature(ldp)
vrf = Vrf(name='vrf1')
ldp.add_force_vrf(vrf)
nbr1 = IPv4LsrNeighbor('1.2.3.4:0')
nbr2 = IPv4LsrNeighbor('1.2.3.5:0')
nbr3 = IPv4LsrNeighbor('1.2.3.6:0')
ldp.device_attr['PE1'].vrf_attr['vrf1'].neighbors = [nbr1, nbr2, nbr3]
def test_8_per_vrf_per_neighbor(self):
acl1 = AccessList(name='acl1')
acl2 = AccessList(name='acl2')
acl3 = AccessList(name='acl3')
acl4 = AccessList(name='acl4')
acl5 = AccessList(name='acl5')
acl6 = AccessList(name='acl6')
acl7 = AccessList(name='acl7')
acl8 = AccessList(name='acl8')
acl9 = AccessList(name='acl9')
acl11 = AccessList(name='acl11')
acl22 = AccessList(name='acl22')
acl33 = AccessList(name='acl33')
acl44 = AccessList(name='acl44')
acl1111 = AccessList(name='acl1111')
acl2222 = AccessList(name='acl2222')
acl3333 = AccessList(name='acl3333')
acl4444 = AccessList(name='acl4444')
ldp = Ldp()
self.link.add_feature(ldp)
vrf = Vrf(name='vrf1')
ldp.add_force_vrf(vrf)
def test_x1_per_vrf_per_af(self):
acl1 = AccessList(name='acl1')
acl2 = AccessList(name='acl2')
acl3 = AccessList(name='acl3')
acl4 = AccessList(name='acl4')
acl5 = AccessList(name='acl5')
acl6 = AccessList(name='acl6')
acl7 = AccessList(name='acl7')
acl8 = AccessList(name='acl8')
acl9 = AccessList(name='acl9')
acl11 = AccessList(name='acl11')
acl22 = AccessList(name='acl22')
acl33 = AccessList(name='acl33')
acl44 = AccessList(name='acl44')
acl1111 = AccessList(name='acl1111')
acl2222 = AccessList(name='acl2222')
acl3333 = AccessList(name='acl3333')
acl4444 = AccessList(name='acl4444')
ldp = Ldp()
self.link.add_feature(ldp)
vrf = Vrf(name='vrf1')
ldp.add_force_vrf(vrf)
ldp.device_attr['PE1'].vrf_attr['vrf1'].address_family_attr['ipv4'].transport_address = '1.2.3.4'
ldp.device_attr['PE1'].vrf_attr['vrf1'].address_family_attr['ipv4'].advertise = False
ldp.device_attr['PE1'].vrf_attr['vrf1'].address_family_attr['ipv4'].advertise_expnull_to_acl = acl4
def test_x2_per_vrf_per_af_per_nbr(self):
acl1 = AccessList(name='acl1')
acl2 = AccessList(name='acl2')
acl3 = AccessList(name='acl3')
acl4 = AccessList(name='acl4')
acl5 = AccessList(name='acl5')
acl6 = AccessList(name='acl6')
acl7 = AccessList(name='acl7')
acl8 = AccessList(name='acl8')
acl9 = AccessList(name='acl9')
acl11 = AccessList(name='acl11')
acl22 = AccessList(name='acl22')
acl33 = AccessList(name='acl33')
acl44 = AccessList(name='acl44')
acl1111 = AccessList(name='acl1111')
acl2222 = AccessList(name='acl2222')
acl3333 = AccessList(name='acl3333')
acl4444 = AccessList(name='acl4444')
nbr1 = IPv4LsrNeighbor('1.2.3.5:0')
nbr2 = IPv4LsrNeighbor('1.2.3.6:0')
def test_3_per_intf(self):
acl1 = AccessList(name='acl1')
acl2 = AccessList(name='acl2')
acl3 = AccessList(name='acl3')
acl4 = AccessList(name='acl4')
acl5 = AccessList(name='acl5')
acl6 = AccessList(name='acl6')
acl7 = AccessList(name='acl7')
acl8 = AccessList(name='acl8')
acl9 = AccessList(name='acl9')
acl11 = AccessList(name='acl11')
acl22 = AccessList(name='acl22')
acl33 = AccessList(name='acl33')
acl44 = AccessList(name='acl44')
acl1111 = AccessList(name='acl1111')
acl2222 = AccessList(name='acl2222')
acl3333 = AccessList(name='acl3333')
acl4444 = AccessList(name='acl4444')
ldp = Ldp()
self.link.add_feature(ldp)
self.link4.add_feature(ldp)
ldp.device_attr['PE1'].interface_attr['GigabitEthernet0/0/0/1'].igp_sync_delay_on_session_up = 250
def test_single_line_config(self):
# For failures
self.maxDiff = None
# Set Genie Tb
testbed = Testbed()
Genie.testbed = testbed
# Device
dev1 = Device(name='PE1', testbed=testbed, os='iosxr')
intf1 = Interface(name='GigabitEthernet0/0/0/0', device=dev1, aliases=['PE1_1'])
subif1 = Interface(name='GigabitEthernet0/0/0/1.10', device=dev1, aliases=['PE1_1'])
vrf = Vrf(name='test', testbed=testbed)
dev1.add_feature(vrf)
# Apply configuration
intf1.description = 'test'
intf1.enabled = True
intf1.mtu = 1492
intf1.vrf = vrf
intf1.mac_address = 'aabb.ccdd.eeff'
intf1.bandwidth = 8192
intf1.load_interval = 33
intf1.unnumbered_intf_ref = 'GigabitEthernet0/0/0/1.10'
intf1.ipv6_autoconf = True
intf1.medium = 'p2p'
# Build config