~blake-rouse/maas/is-importing-2.1

« back to all changes in this revision

Viewing changes to src/maasserver/models/tests/test_interface.py

  • Committer: LaMont Jones
  • Date: 2016-12-07 12:59:10 UTC
  • mfrom: (5561 2.1)
  • mto: This revision was merged to the branch mainline in revision 5563.
  • Revision ID: lamont@canonical.com-20161207125910-fow7gg8v9bo0s1iq
merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2045
2045
            "IP address is not in the given subnet '%s'." % subnet,
2046
2046
            str(error))
2047
2047
 
 
2048
    def test__AUTO_link_sets_vlan_if_vlan_undefined(self):
 
2049
        interface = factory.make_Interface(INTERFACE_TYPE.PHYSICAL)
 
2050
        network = factory.make_ipv4_network()
 
2051
        subnet = factory.make_Subnet(
 
2052
            vlan=interface.vlan, cidr=str(network.cidr))
 
2053
        interface.vlan = None
 
2054
        interface.save()
 
2055
        interface.link_subnet(INTERFACE_LINK_TYPE.AUTO, subnet)
 
2056
        interface = reload_object(interface)
 
2057
        self.assertThat(interface.vlan, Equals(subnet.vlan))
 
2058
 
2048
2059
    def test__STATIC_not_allowed_if_ip_address_in_dynamic_range(self):
2049
2060
        interface = factory.make_Interface(INTERFACE_TYPE.PHYSICAL)
2050
2061
        subnet = factory.make_ipv4_Subnet_with_IPRanges(vlan=interface.vlan)