当前位置: 首页>>代码示例>>Python>>正文


Python FakeDeviceConnect.get_xml_config方法代码示例

本文整理汇总了Python中test_dm_utils.FakeDeviceConnect.get_xml_config方法的典型用法代码示例。如果您正苦于以下问题:Python FakeDeviceConnect.get_xml_config方法的具体用法?Python FakeDeviceConnect.get_xml_config怎么用?Python FakeDeviceConnect.get_xml_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test_dm_utils.FakeDeviceConnect的用法示例。


在下文中一共展示了FakeDeviceConnect.get_xml_config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_lacp_config

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
 def check_lacp_config(self, ae_name, esi, pi_list):
     config = FakeDeviceConnect.get_xml_config()
     interfaces = self.get_interfaces(config, ae_name)
     if not interfaces:
         raise Exception("No AE Config generated")
     found = False
     for intf in interfaces:
         if not intf.get_aggregated_ether_options() or not \
             intf.get_aggregated_ether_options().get_lacp():
             continue
         lacp = intf.get_aggregated_ether_options().get_lacp()
         if lacp.get_active() is not None and lacp.get_admin_key() and \
             lacp.get_system_id() and lacp.get_system_priority():
             if esi[-17:] == lacp.get_system_id():
                 found = True
                 break
     if not found:
         raise Exception("AE interface config is not correct: " + esi)
     for pi in pi_list or []:
         interfaces = self.get_interfaces(config, pi)
         found = False
         for intf in interfaces or []:
             if intf.get_gigether_options() and \
                 intf.get_gigether_options().get_ieee_802_3ad():
                 found = True
                 break
         if not found:
             raise Exception("AE membership config not generated: " + pi)
开发者ID:rombie,项目名称:contrail-controller,代码行数:30,代码来源:test_dm_qfx_basic.py

示例2: check_spine_bogus_lo0_ip

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
    def check_spine_bogus_lo0_ip(self, int_vn):
        vrf_name = DMUtils.make_vrf_name(int_vn.fq_name[-1],
                                  int_vn.virtual_network_network_id, "l3")
        config = FakeDeviceConnect.get_xml_config()
        ris = self.get_routing_instances(config, vrf_name)
        if not ris:
            raise Exception("No RI Config found for internal vn: " + vrf_name)
        ri = ris[0]
        intfs = ri.get_interface()
        if not intfs:
            raise Exception("No interfaces Config found for internal vn: " + vrf_name)
        found = False
        ifl_num = str(1000 + int(int_vn.virtual_network_network_id))
        bogus_lo0 = "lo0." + ifl_num
        for intf in intfs:
            if intf.name == bogus_lo0:
                found = True
                break
        if not found:
            raise Exception("No lo0 interface Config found for internal vn: " + vrf_name)

        interfaces = self.get_interfaces(config)
        if not interfaces:
            raise Exception("Interface Config not lo0")
        found = False
        for intf in interfaces:
            if intf.name == "lo0" and intf.get_unit() and intf.get_unit()[0].get_name() == ifl_num:
                found = True
        if not found:
            raise Exception("Lo0 Interface unit not found")
开发者ID:rombie,项目名称:contrail-controller,代码行数:32,代码来源:test_dm_qfx_basic.py

示例3: check_spine_evpn_type5_config

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
 def check_spine_evpn_type5_config(self, int_vn, lr_obj):
     vrf_name = DMUtils.make_vrf_name(int_vn.fq_name[-1],
                               int_vn.virtual_network_network_id, "l3")
     config = FakeDeviceConnect.get_xml_config()
     ris = self.get_routing_instances(config, vrf_name)
     if not ris:
         raise Exception("No RI Config found for internal vn %s" %vrf_name)
     ri = ris[0]
     internal_vn_name = DMUtils.get_lr_internal_vn_name(lr_obj.uuid)
     vn_fq = lr_obj.get_fq_name()[:-1] + [internal_vn_name]
     vn_obj = self._vnc_lib.virtual_network_read(fq_name=vn_fq)
     vn_obj_properties = vn_obj.get_virtual_network_properties()
     # check ri has protocol evpn
     if not ri.protocols:
         raise Exception("protocol not present in internal vn %s" %vrf_name)
     if not ri.protocols.evpn:
         raise Exception("evpn not present in ri_protocols for internal vn \
                                                              %s" %vrf_name)
     # get ip_prefix config
     ip_pfx_obj = ri.protocols.evpn.ip_prefix_support
     vnc_vni = vn_obj_properties.vxlan_network_identifier
     if ip_pfx_obj.encapsulation != "vxlan":
         raise Exception("vxlan encaps not set in ip_prefix for int vn \
                                                          %s" %vrf_name)
     if (ip_pfx_obj.vni != '1111') or (vnc_vni != '1111'):
         raise Exception("vni mismatch for int vn %s: \
                          in vnc %s, confiugured %s" %(vrf_name,
                                                        vnc_vni,
                                                ip_pfx_obj.vni))
开发者ID:rombie,项目名称:contrail-controller,代码行数:31,代码来源:test_dm_qfx_basic.py

示例4: check_firewall_config

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
 def check_firewall_config(self, fnames, check=True):
     config = FakeDeviceConnect.get_xml_config()
     fwalls = config.get_firewall()
     if not fwalls or not fwalls.get_family() or not fwalls.get_family().get_ethernet_switching():
         if check:
             raise Exception("No eth firewalls configured")
         else:
             return
     ff = fwalls.get_family().get_ethernet_switching().get_filter()
     if check:
         if not ff:
             raise Exception("No eth firewall filter configured")
     elif ff:
         raise Exception("firewall filters still configured")
     else:
         return
     conf_filters = [f.name for f in ff]
     for fname in fnames:
         if fname not in conf_filters:
             raise Exception("firewall filter %s configured"%(fname))
     if check:
         found = False
         for f in ff or []:
             for term in f.get_term() or []:
                 if term.name == 'allow-dns-dhcp':
                     found = True
                     break
         if not found:
             raise Exception("firewall filter default term: allow-dhcp-dns not found")
开发者ID:rombie,项目名称:contrail-controller,代码行数:31,代码来源:test_dm_qfx_basic.py

示例5: check_evpn_config

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
    def check_evpn_config(self, global_encap, vn_obj, interfaces=[]):
        vrf_name_l2 = DMUtils.make_vrf_name(vn_obj.fq_name[-1], vn_obj.virtual_network_network_id, 'l2')
        network_id = vn_obj.get_virtual_network_network_id()
        vn_obj_properties = vn_obj.get_virtual_network_properties()
        vxlan_id = vn_obj_properties.get_vxlan_network_identifier()
        fwd_mode = vn_obj_properties.get_forwarding_mode()

        config = FakeDeviceConnect.get_xml_config()
        ri = self.get_routing_instances(config, vrf_name_l2)[0]
        ri_intf = "irb." + str(network_id) if fwd_mode == 'l2_l3' else None
        protocols = ri.get_protocols()
        intfs = []
        if global_encap in ['MPLSoGRE', 'MPLSoUDP']:
            self.assertEqual(ri.get_instance_type(), 'evpn')
            self.assertEqual(ri.get_vlan_id(), 'none')
            self.assertEqual(ri.get_routing_interface(), ri_intf)
            intfs = protocols.get_evpn().get_interface() if interfaces else []

        if global_encap == 'VXLAN':
            self.assertEqual(protocols.get_evpn().get_encapsulation(), 'vxlan')
            bd = ri.get_bridge_domains().get_domain()[0]
            self.assertEqual(ri.get_instance_type(),  'virtual-switch')
            self.assertEqual(bd.name, "bd-" + str(vxlan_id))
            self.assertEqual(bd.get_vlan_id(), 'none')
            self.assertEqual(bd.get_routing_interface(), ri_intf)
            intfs = bd.get_interface() or []

        ifnames = [intf.name for intf in intfs]
        self.assertTrue(set(interfaces or []) <= set(ifnames))

        return
开发者ID:Juniper,项目名称:contrail-controller,代码行数:33,代码来源:test_dm_networks.py

示例6: check_interface_ip_config

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
    def check_interface_ip_config(self, if_name='', ri_name='',
                     ip_check='', ip_type='v4', network_id='', is_free=False):
        check = False
        if is_free:
            check = True

        config = FakeDeviceConnect.get_xml_config()
        ifl_num = DMUtils.compute_lo0_unit_number(network_id)
        intfs = self.get_interfaces(config, if_name)
        found = False
        for intf in intfs or []:
            ips = self.get_ip_list(intf, ip_type, ifl_num)
            if ip_check in ips:
                found = True
                break

        if not found:
            self.assertTrue(check)

        ris = self.get_routing_instances(config, ri_name)
        if not ris:
            self.assertTrue(check)
        ri = ris[0]
        intfs = ri.get_interface() or []
        found = False
        for intf in intfs:
            if intf.get_name() == if_name + "." + ifl_num:
                found = True
                break
        if not found:
            self.assertTrue(check)
        return
开发者ID:Juniper,项目名称:contrail-controller,代码行数:34,代码来源:test_dm_networks.py

示例7: check_l2_evpn_vrf_targets

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
 def check_l2_evpn_vrf_targets(self, target_id):
     config = FakeDeviceConnect.get_xml_config()
     protocols = config.get_protocols()
     evpn = protocols.get_evpn()
     options = evpn.get_vni_options()
     vni = options.get_vni()[0]
     self.assertEqual(vni.get_vrf_target().get_community(), target_id)
开发者ID:rombie,项目名称:contrail-controller,代码行数:9,代码来源:test_dm_qfx_basic.py

示例8: check_ri_config

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
 def check_ri_config(self, vn_obj, vn_mode='l2', check=True):
     vrf_name = DMUtils.make_vrf_name(vn_obj.fq_name[-1],
                               vn_obj.virtual_network_network_id, vn_mode)
     config = FakeDeviceConnect.get_xml_config()
     ris = self.get_routing_instances(config, vrf_name)
     if not check and ris:
         raise Exception("Routing Instances Present for: " + vrf_name)
     if check and not ris:
         raise Exception("Routing Instances not Present for: " + vrf_name)
开发者ID:rombie,项目名称:contrail-controller,代码行数:11,代码来源:test_dm_qfx_basic.py

示例9: check_chassis_config

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
 def check_chassis_config(self):
     config = FakeDeviceConnect.get_xml_config()
     chassis = config.get_chassis()
     if not chassis:
         raise Exception("No Chassis Config generated")
     aggr_dv = chassis.get_aggregated_devices()
     eth = aggr_dv.get_ethernet()
     dv_count = eth.get_device_count()
     device_count =  DMUtils.get_max_ae_device_count()
     self.assertEqual(device_count, dv_count)
开发者ID:rombie,项目名称:contrail-controller,代码行数:12,代码来源:test_dm_qfx_basic.py

示例10: check_switch_options_export_policy_config

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
 def check_switch_options_export_policy_config(self, should_present=True):
     config = FakeDeviceConnect.get_xml_config()
     switch_opts = config.get_switch_options()
     self.assertIsNotNone(switch_opts)
     exports = switch_opts.get_vrf_export() or []
     export_name = DMUtils.get_switch_export_policy_name()
     if not should_present:
         self.assertNotIn(export_name, exports)
     else:
         self.assertIn(export_name, exports)
开发者ID:rombie,项目名称:contrail-controller,代码行数:12,代码来源:test_dm_qfx_basic.py

示例11: check_tunnel_source_ip

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
 def check_tunnel_source_ip(self, ip_check='', look_for=True):
     config = FakeDeviceConnect.get_xml_config()
     tunnels = self.get_dynamic_tunnels(config) or DynamicTunnels()
     if look_for:
         self.assertIn(ip_check, [tunnel.source_address
                        for tunnel in tunnels.get_dynamic_tunnel()])
     else:
         self.assertNotIn(ip_check, [tunnel.source_address
                        for tunnel in tunnels.get_dynamic_tunnel()])
     return
开发者ID:cijohnson,项目名称:contrail-controller,代码行数:12,代码来源:test_dm_bgp.py

示例12: check_l2_evpn_proto_config

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
 def check_l2_evpn_proto_config(self, vn_obj, vni):
     config = FakeDeviceConnect.get_xml_config()
     protocols = config.get_protocols()
     evpn_config = protocols.get_evpn()
     if not evpn_config or not evpn_config.get_vni_options():
         raise Exception("No Correct EVPN Config generated")
     vni_options = evpn_config.get_vni_options()
     for vni_op in vni_options.get_vni() or []:
         if vni_op.name == str(vni) and vni_op.vrf_target.community:
             return
     raise Exception("No Correct EVPN Config generated")
开发者ID:rombie,项目名称:contrail-controller,代码行数:13,代码来源:test_dm_qfx_basic.py

示例13: check_vlans_config

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
 def check_vlans_config(self, vn_obj, vni, vn_mode):
     vrf_name = DMUtils.make_vrf_name(vn_obj.fq_name[-1], vn_obj.virtual_network_network_id, vn_mode)
     config = FakeDeviceConnect.get_xml_config()
     vlans = config.get_vlans()
     self.assertIsNotNone(vlans)
     vlans = vlans.get_vlan() or []
     vlan_name = vrf_name[1:]
     for vlan in vlans:
         if vlan.get_name() == vlan_name and str(vlan.get_vxlan().get_vni()) == str(vni):
             return
     raise Exception("Vlan Config Not Found: %s"%(vlan_name))
开发者ID:cijohnson,项目名称:contrail-controller,代码行数:13,代码来源:test_dm_qfx_basic.py

示例14: check_lo0_ip_config

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
 def check_lo0_ip_config(self, ip_check=''):
     config = FakeDeviceConnect.get_xml_config()
     intfs = self.get_interfaces(config, "lo0")
     if ip_check:
         ips = self.get_ip_list(intfs[0], "v4", "0")
         self.assertEqual(ip_check, ips[0])
     else:
         if not intfs or not self.get_ip_list(intfs[0], "v4", "0"):
             return
         self.assertTrue(False)
     return
开发者ID:cijohnson,项目名称:contrail-controller,代码行数:13,代码来源:test_dm_bgp.py

示例15: check_switch_options_config

# 需要导入模块: from test_dm_utils import FakeDeviceConnect [as 别名]
# 或者: from test_dm_utils.FakeDeviceConnect import get_xml_config [as 别名]
    def check_switch_options_config(self, vn_obj, vn_mode):
        vrf_name = DMUtils.make_vrf_name(vn_obj.fq_name[-1], vn_obj.virtual_network_network_id, vn_mode)

        config = FakeDeviceConnect.get_xml_config()
        switch_opts = config.get_switch_options()
        self.assertIsNotNone(switch_opts)
        self.assertEqual(switch_opts.get_vtep_source_interface(), "lo0.0")
        import_name = DMUtils.make_import_name(vrf_name)
        imports = switch_opts.get_vrf_import() or []
        self.assertIn(import_name, imports)
        export_name = DMUtils.make_export_name(vrf_name)
        exports = switch_opts.get_vrf_export() or []
        self.assertNotIn(export_name, exports)
开发者ID:cijohnson,项目名称:contrail-controller,代码行数:15,代码来源:test_dm_qfx_basic.py


注:本文中的test_dm_utils.FakeDeviceConnect.get_xml_config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。