# Path: netman/core/objects/port_modes.py
# ACCESS = "ACCESS"
# 
# TRUNK = "TRUNK"


from hamcrest import equal_to, assert_that, has_length, is_, none
from netaddr import IPNetwork, IPAddress
from netman.core.objects.access_groups import IN, OUT
from netman.core.objects.exceptions import UnknownVlan, UnknownInterface, \
    UnknownResource
from netman.core.objects.interface_states import OFF, ON
from netman.core.objects.port_modes import ACCESS, TRUNK
from tests.adapters.configured_test_case import ConfiguredTestCase, skip_on_switches
    @skip_on_switches("juniper_mx", "arista_http")
    def test_native_trunk(self):
        self.client.add_vlan(2999, name="my-test-vlan")

        self.client.set_trunk_mode(self.test_port)

        self.client.set_interface_native_vlan(self.test_port, vlan=2999)

        self.client.unset_interface_native_vlan(self.test_port)

        self.client.set_access_mode(self.test_port)

        self.client.remove_vlan(2999)

    @skip_on_switches("juniper_mx", "arista_http")
    def test_passing_from_trunk_mode_to_access_gets_rid_of_stuff_in_trunk_mode(self):
        self.client.add_vlan(1100)
        self.client.add_vlan(1200)
        self.client.add_vlan(1300)
        self.client.add_vlan(1400)

        self.client.set_trunk_mode(self.test_port)
        self.client.set_interface_native_vlan(self.test_port, vlan=1200)
        self.client.add_trunk_vlan(self.test_port, vlan=1100)
        self.client.add_trunk_vlan(self.test_port, vlan=1300)
        self.client.add_trunk_vlan(self.test_port, vlan=1400)

        interfaces = self.client.get_interfaces()
        test_if = next(i for i in interfaces if i.name == self.test_port)


# Path: netman/core/objects/port_modes.py
# ACCESS = "ACCESS"
# 
# TRUNK = "TRUNK"


# Path: tests/adapters/unified_tests/vlan_management_test.py
from hamcrest import equal_to, assert_that, has_length, is_, none
from netaddr import IPNetwork, IPAddress
from netman.core.objects.access_groups import IN, OUT
from netman.core.objects.exceptions import UnknownVlan, UnknownInterface, \
    UnknownResource
from netman.core.objects.interface_states import OFF, ON
from netman.core.objects.port_modes import ACCESS, TRUNK
from tests.adapters.configured_test_case import ConfiguredTestCase, skip_on_switches

    @skip_on_switches("juniper_mx", "arista_http")
    def test_native_trunk(self):
        self.client.add_vlan(2999, name="my-test-vlan")

        self.client.set_trunk_mode(self.test_port)

        self.client.set_interface_native_vlan(self.test_port, vlan=2999)

        self.client.unset_interface_native_vlan(self.test_port)

        self.client.set_access_mode(self.test_port)

        self.client.remove_vlan(2999)

    @skip_on_switches("juniper_mx", "arista_http")
    def test_passing_from_trunk_mode_to_access_gets_rid_of_stuff_in_trunk_mode(self):
        self.client.add_vlan(1100)
        self.client.add_vlan(1200)
        self.client.add_vlan(1300)
        self.client.add_vlan(1400)

        self.client.set_trunk_mode(self.test_port)
        self.client.set_interface_native_vlan(self.test_port, vlan=1200)
        self.client.add_trunk_vlan(self.test_port, vlan=1100)
        self.client.add_trunk_vlan(self.test_port, vlan=1300)
        self.client.add_trunk_vlan(self.test_port, vlan=1400)

        interfaces = self.client.get_interfaces()
        test_if = next(i for i in interfaces if i.name == self.test_port)


        assert_that(test_if.port_mode, equal_to(TRUNK))