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


Python Network.clean方法代码示例

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


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

示例1: test2_create_ipv4_interface_from_domain

# 需要导入模块: from cyder.cydhcp.network.models import Network [as 别名]
# 或者: from cyder.cydhcp.network.models.Network import clean [as 别名]
    def test2_create_ipv4_interface_from_domain(self):

        v, _ = Vlan.objects.get_or_create(name="private", number=3)
        s, _ = Site.objects.get_or_create(name="phx1")
        s1, _ = Site.objects.get_or_create(name="corp", parent=s)
        d, _ = Domain.objects.get_or_create(name="phx1.mozilla.com")
        d1, _ = Domain.objects.get_or_create(name="corp.phx1.mozilla.com")
        d2, _ = Domain.objects.get_or_create(
            name="private.corp.phx1.mozilla.com")

        d, _ = Domain.objects.get_or_create(name="arpa")
        d, _ = Domain.objects.get_or_create(name="in-addr.arpa")
        d, _ = Domain.objects.get_or_create(name="14.in-addr.arpa")
        n = Network(network_str="14.0.0.0/8", ip_type="4")
        n.clean()
        n.site = s1
        n.vlan = v
        n.save()

        r = Range(start_str="14.0.0.0", end_str="14.0.0.2",
                  network=n)
        r.clean()
        r.save()

        intr, errors = create_ipv4_intr_from_domain(
            "foo", "private.corp.phx1", self.system,
            "11:22:33:44:55:66")
        self.assertEqual(errors, None)
        self.assertTrue(isinstance(intr, StaticInterface))
开发者ID:Ziaunys,项目名称:chili,代码行数:31,代码来源:intr_from_domain.py

示例2: setUp

# 需要导入模块: from cyder.cydhcp.network.models import Network [as 别名]
# 或者: from cyder.cydhcp.network.models.Network import clean [as 别名]
    def setUp(self):
        self.system = System()
        self.system.save()
        d1 = create_fake_zone("oregonstate.com", suffix="")
        soa = d1.soa
        self.soa = soa

        v, _ = Vlan.objects.get_or_create(name="private", number=3)
        s, _ = Site.objects.get_or_create(name="phx1")
        s1, _ = Site.objects.get_or_create(name="corp", parent=s)
        d, _ = Domain.objects.get_or_create(name="phx1.oregonstate.com")
        d.soa = soa
        d.save()
        d1, _ = Domain.objects.get_or_create(name="corp.phx1.oregonstate.com")
        d1.soa = soa
        d1.save()
        d2, _ = Domain.objects.get_or_create(
            name="private.corp.phx1.oregonstate.com")
        d2.soa = soa
        d2.save()

        d, _ = Domain.objects.get_or_create(name="arpa")
        d, _ = Domain.objects.get_or_create(name="in-addr.arpa")
        d, _ = Domain.objects.get_or_create(name="15.in-addr.arpa")
        n = Network(network_str="15.0.0.0/8", ip_type="4")
        n.clean()
        n.site = s1
        n.vlan = v
        n.save()

        r = Range(start_str="15.0.0.0", end_str="15.0.0.10",
                  network=n, ip_type='4')
        r.clean()
        r.save()
开发者ID:alecdhuse,项目名称:cyder,代码行数:36,代码来源:intr_from_range.py

示例3: test8_create_ipv4_interface

# 需要导入模块: from cyder.cydhcp.network.models import Network [as 别名]
# 或者: from cyder.cydhcp.network.models.Network import clean [as 别名]
    def test8_create_ipv4_interface(self):
        v, _ = Vlan.objects.get_or_create(name="8db", number=3)
        s, _ = Site.objects.get_or_create(name="8scl3")
        s1, _ = Site.objects.get_or_create(name="8dmz", parent=s)
        d, _ = Domain.objects.get_or_create(name="8scl3.mozilla.com")
        d, _ = Domain.objects.get_or_create(name="8dmz.8scl3.mozilla.com")
        d, _ = Domain.objects.get_or_create(name="8db.8dmz.8scl3.mozilla.com")

        d, _ = Domain.objects.get_or_create(name="arpa")
        d, _ = Domain.objects.get_or_create(name="in-addr.arpa")
        d, _ = Domain.objects.get_or_create(name="15.in-addr.arpa")
        n = Network(network_str="15.0.0.0/8", ip_type="4")
        n.clean()
        n.site = s1
        n.vlan = v
        n.save()

        r = Range(start_str="15.0.0.0", end_str="15.0.0.2",
                  network=n)
        r.clean()
        r.save()

        intr, errors = create_ipv4_interface(
            "foo", "8db", "8dmz.8scl3", self.system,
            "11:22:33:44:55:66", "mozilla.com")
        self.assertEqual(errors, None)
        self.assertTrue(isinstance(intr, StaticInterface))
开发者ID:Ziaunys,项目名称:chili,代码行数:29,代码来源:intr_from_domain.py

示例4: test1_create_ipv4_interface_from_domain

# 需要导入模块: from cyder.cydhcp.network.models import Network [as 别名]
# 或者: from cyder.cydhcp.network.models.Network import clean [as 别名]
    def test1_create_ipv4_interface_from_domain(self):

        v, _ = Vlan.objects.get_or_create(name="private", number=3)
        s, _ = Site.objects.get_or_create(name="phx1")
        d, _ = Domain.objects.get_or_create(name="phx1.mozilla.com")
        d, _ = Domain.objects.get_or_create(name="private.phx1.mozilla.com")

        d, _ = Domain.objects.get_or_create(name="arpa")
        d, _ = Domain.objects.get_or_create(name="in-addr.arpa")
        d, _ = Domain.objects.get_or_create(name="13.in-addr.arpa")
        n = Network(network_str="13.0.0.0/8", ip_type="4")
        n.clean()
        n.site = s
        n.vlan = v
        n.save()

        r = Range(start_str="13.0.0.0", end_str="13.0.0.2",
                  network=n, ip_type='4')
        r.clean()
        r.save()

        intr, errors = create_ipv4_intr_from_domain(
            label="foo", domain_name="private.phx1", system=self.system,
            mac="11:22:33:44:55:66")
        self.assertEqual(errors, None)
        self.assertTrue(isinstance(intr, StaticInterface))
开发者ID:alecdhuse,项目名称:cyder,代码行数:28,代码来源:intr_from_domain.py

示例5: do_basic_add_network

# 需要导入模块: from cyder.cydhcp.network.models import Network [as 别名]
# 或者: from cyder.cydhcp.network.models.Network import clean [as 别名]
 def do_basic_add_network(self, network, prefixlen, ip_type, name=None,
                          vlan=None, site=None):
     n = Network(network_str=network + "/" + prefixlen, ip_type=ip_type,
                 site=site, vlan=vlan)
     n.clean()
     n.save()
     return n
开发者ID:alecdhuse,项目名称:cyder,代码行数:9,代码来源:tests.py

示例6: do_basic_add

# 需要导入模块: from cyder.cydhcp.network.models import Network [as 别名]
# 或者: from cyder.cydhcp.network.models.Network import clean [as 别名]
 def do_basic_add(self, network, prefixlen, ip_type,
                  ame=None, number=None, site=None):
     s = Network(network_str=network + "/" + prefixlen,
                 ip_type=ip_type, site=site)
     s.clean()
     s.save()
     self.assertTrue(s)
     return s
开发者ID:alecdhuse,项目名称:cyder,代码行数:10,代码来源:tests.py

示例7: test1_create_ipv4_interface_network_str

# 需要导入模块: from cyder.cydhcp.network.models import Network [as 别名]
# 或者: from cyder.cydhcp.network.models.Network import clean [as 别名]
    def test1_create_ipv4_interface_network_str(self):
        v, _ = Vlan.objects.get_or_create(name="12db", number=3)
        s, _ = Site.objects.get_or_create(name="12scl3")
        d, _ = Domain.objects.get_or_create(name="12scl3.mozilla.com")
        d, _ = Domain.objects.get_or_create(name="12db.12scl3.mozilla.com")

        d, _ = Domain.objects.get_or_create(name="arpa")
        d, _ = Domain.objects.get_or_create(name="in-addr.arpa")
        d, _ = Domain.objects.get_or_create(name="12.in-addr.arpa")
        n = Network(network_str="12.0.0.0/24", ip_type="4")
        n.clean()
        n.site = s
        n.vlan = v
        n.save()

        n1 = Network(network_str="12.0.1.0/24", ip_type="4")
        n1.clean()
        n1.site = s
        n1.vlan = v
        n1.save()

        r = Range(start_str="12.0.0.0", end_str="12.0.0.2",
                  network=n)
        r.clean()
        r.save()

        r1 = Range(start_str="12.0.1.0", end_str="12.0.1.2",
                   network=n1)
        r1.clean()
        r1.save()

        intr, errors = create_ipv4_interface(
            "foo", "12db", "12scl3", self.system,
            "11:22:33:4e:55:66", "mozilla.com")
        self.assertTrue('network' in errors)
        self.assertTrue(
            errors['network'][0].find("too many networks associated") != -1)
        # Look for a non-existant network
        intr, errors = create_ipv4_interface(
            "foo", "12db", "12scl3", self.system,
            "11:22:33:4e:55:66", "mozilla.com", network_str="12.0.99.0/24")
        self.assertTrue('network' in errors)
        intr, errors = create_ipv4_interface(
            "foo", "12db", "12scl3", self.system,
            "11:22:33:4e:55:66", "mozilla.com", network_str="12.0.0.0/24")
        self.assertFalse(errors)
        self.assertTrue(isinstance(intr, StaticInterface))
开发者ID:Ziaunys,项目名称:chili,代码行数:49,代码来源:intr_from_domain.py

示例8: test6_create_ipv4_interface

# 需要导入模块: from cyder.cydhcp.network.models import Network [as 别名]
# 或者: from cyder.cydhcp.network.models.Network import clean [as 别名]
    def test6_create_ipv4_interface(self):
        v, _ = Vlan.objects.get_or_create(name="6db", number=3)
        s, _ = Site.objects.get_or_create(name="6scl3")
        d, _ = Domain.objects.get_or_create(name="6scl3.mozilla.com")
        d, _ = Domain.objects.get_or_create(name="6db.6scl3.mozilla.com")
        d, _ = Domain.objects.get_or_create(name="arpa")
        d, _ = Domain.objects.get_or_create(name="in-addr.arpa")
        d, _ = Domain.objects.get_or_create(name="11.in-addr.arpa")
        n = Network(network_str="11.0.0.0/8", ip_type="4")
        n.clean()
        n.site = s
        n.vlan = v
        n.save()

        r = Range(start_str="11.0.0.0", end_str="11.0.0.2",
                  network=n, ip_type='4')
        r.clean()
        r.save()

        s = StaticInterface(label="fab", domain=d, ip_type="4",
                            ip_str="11.0.0.0", system=self.system,
                            mac="00:00:00:00:00:00")
        s.clean()
        s.save()

        s = StaticInterface(label="fab", domain=d, ip_type="4",
                            ip_str="11.0.0.1", system=self.system,
                            mac="00:00:00:00:00:00")
        s.clean()
        s.save()

        s = StaticInterface(label="fab", domain=d, ip_type="4",
                            ip_str="11.0.0.2", system=self.system,
                            mac="00:00:00:00:00:00")
        s.clean()
        s.save()

        intr, errors = create_ipv4_interface(
            "foo", "6db", "6scl3", self.system,
            "11:22:33:44:55:66", "mozilla.com")
        self.assertEqual(intr, None)
        self.assertTrue("vlan" not in errors)
        self.assertTrue("site" not in errors)
        self.assertTrue("domain" not in errors)
        self.assertTrue("network" not in errors)
        self.assertTrue("range" not in errors)
        self.assertTrue("ip" in errors)
开发者ID:alecdhuse,项目名称:cyder,代码行数:49,代码来源:intr_from_domain.py

示例9: test5_create_ipv4_interface

# 需要导入模块: from cyder.cydhcp.network.models import Network [as 别名]
# 或者: from cyder.cydhcp.network.models.Network import clean [as 别名]
 def test5_create_ipv4_interface(self):
     v, _ = Vlan.objects.get_or_create(name="5db", number=3)
     s, _ = Site.objects.get_or_create(name="5scl3")
     d, _ = Domain.objects.get_or_create(name="5scl3.mozilla.com")
     d, _ = Domain.objects.get_or_create(name="5db.5scl3.mozilla.com")
     n = Network(network_str="10.0.0.0/8", ip_type="4")
     n.clean()
     n.site = s
     n.vlan = v
     n.save()
     intr, errors = create_ipv4_interface(
         "foo", "5db", "5scl3", self.system,
         "11:22:33:44:55:66", "mozilla.com")
     self.assertEqual(intr, None)
     self.assertTrue("vlan" not in errors)
     self.assertTrue("site" not in errors)
     self.assertTrue("domain" not in errors)
     self.assertTrue("network" not in errors)
     self.assertTrue("range" in errors)
开发者ID:Ziaunys,项目名称:chili,代码行数:21,代码来源:intr_from_domain.py

示例10: setUp

# 需要导入模块: from cyder.cydhcp.network.models import Network [as 别名]
# 或者: from cyder.cydhcp.network.models.Network import clean [as 别名]
    def setUp(self):
        self.system = System()
        Domain.objects.get_or_create(name="com")
        d1, _ = Domain.objects.get_or_create(name="mozilla.com")
        soa, _ = SOA.objects.get_or_create(
            primary="fo.bar", contact="foo.bar.com",
            comment="foo bar")
        self.s = soa
        d1.soa = soa
        d1.save()

        v, _ = Vlan.objects.get_or_create(name="private", number=3)
        s, _ = Site.objects.get_or_create(name="phx1")
        s1, _ = Site.objects.get_or_create(name="corp", parent=s)
        d, _ = Domain.objects.get_or_create(name="phx1.mozilla.com")
        d.soa = soa
        d.save()
        d1, _ = Domain.objects.get_or_create(name="corp.phx1.mozilla.com")
        d1.soa = soa
        d1.save()
        d2, _ = Domain.objects.get_or_create(
            name="private.corp.phx1.mozilla.com")
        d2.soa = soa
        d2.save()

        d, _ = Domain.objects.get_or_create(name="arpa")
        d, _ = Domain.objects.get_or_create(name="in-addr.arpa")
        d, _ = Domain.objects.get_or_create(name="ipv6.arpa")
        d, _ = Domain.objects.get_or_create(name="15.in-addr.arpa")
        d, _ = Domain.objects.get_or_create(name="2.in-addr.arpa")
        n = Network(network_str="15.0.0.0/8", ip_type="4")
        n.clean()
        n.site = s1
        n.vlan = v
        n.save()

        r = Range(start_str="15.0.0.0", end_str="15.0.0.10",
                  network=n)
        r.clean()
        r.save()
开发者ID:Ziaunys,项目名称:chili,代码行数:42,代码来源:free_ip.py


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