# 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
            self.client.remove_vlan(2999)

        with self.assertRaises(UnknownVlan):
            self.client.set_access_vlan(self.test_port, vlan=2999)

        self.client.set_trunk_mode(self.test_port)

        with self.assertRaises(UnknownVlan):
            self.client.add_trunk_vlan(self.test_port, vlan=2999)

        with self.assertRaises(UnknownVlan):
            self.client.set_interface_native_vlan(self.test_port, vlan=2999)

        with self.assertRaises(UnknownVlan):
            self.client.add_trunk_vlan(self.test_port, vlan=2999)

        self.client.add_vlan(2999, name="my-test-vlan")
        # TODO(jprovost) Unify switch adapters to raise the same exception
        with self.assertRaises(UnknownResource):
            self.client.remove_trunk_vlan(self.test_port, vlan=2999)

    @skip_on_switches("juniper", "juniper_qfx_copper", "juniper_mx", "arista_http")
    def test_invalid_interface_parameter_fails(self):
        with self.assertRaises(UnknownInterface):
            self.client.set_interface_state('42/9999', ON)

        with self.assertRaises(UnknownInterface):
            self.client.set_interface_state('42/9999', OFF)

        with self.assertRaises(UnknownInterface):

# 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

            self.client.remove_vlan(2999)

        with self.assertRaises(UnknownVlan):
            self.client.set_access_vlan(self.test_port, vlan=2999)

        self.client.set_trunk_mode(self.test_port)

        with self.assertRaises(UnknownVlan):
            self.client.add_trunk_vlan(self.test_port, vlan=2999)

        with self.assertRaises(UnknownVlan):
            self.client.set_interface_native_vlan(self.test_port, vlan=2999)

        with self.assertRaises(UnknownVlan):
            self.client.add_trunk_vlan(self.test_port, vlan=2999)

        self.client.add_vlan(2999, name="my-test-vlan")
        # TODO(jprovost) Unify switch adapters to raise the same exception
        with self.assertRaises(UnknownResource):
            self.client.remove_trunk_vlan(self.test_port, vlan=2999)

    @skip_on_switches("juniper", "juniper_qfx_copper", "juniper_mx", "arista_http")
    def test_invalid_interface_parameter_fails(self):
        with self.assertRaises(UnknownInterface):
            self.client.set_interface_state('42/9999', ON)

        with self.assertRaises(UnknownInterface):
            self.client.set_interface_state('42/9999', OFF)

        with self.assertRaises(UnknownInterface):

            self.client.set_access_mode('42/9999')