Example #1
0
    def test_fails_if_the_vlan_already_exist(self):
        self.client.add_vlan(1000)

        with self.assertRaises(VlanAlreadyExist) as expect:
            self.client.add_vlan(1000)

        assert_that(expect.exception, has_message("Vlan 1000 already exists"))
Example #2
0
    def test_getinterface_nonexistent_raises(self):
        with self.assertRaises(UnknownInterface) as expect:
            self.client.get_interface('ethernet 1/nonexistent2000')

        assert_that(
            expect.exception,
            has_message("Unknown interface ethernet 1/nonexistent2000"))
    def test_fails_if_the_interface_does_not_exist(self):
        with self.assertRaises(UnknownInterface) as expect:
            self.client.set_interface_auto_negotiation_state('ge-0/0/128',
                                                             state=ON)

        assert_that(expect.exception,
                    has_message("Unknown interface ge-0/0/128"))
Example #4
0
    def test_fails_if_the_value_is_not_a_boolean(self):
        self.client.add_vlan(1000)

        with self.assertRaises(BadMplsIpState) as expect:
            self.client.set_vlan_mpls_ip_state(1000, 30)

        assert_that(expect.exception,
                    has_message('MPLS IP state is invalid : 30'))
    def test_raises_UnknownVlan_when_operating_on_a_vlan_that_does_not_exist(
            self):
        with self.assertRaises(UnknownVlan) as expect:
            self.client.set_vlan_unicast_rpf_mode(2000, STRICT)

        assert_that(expect.exception, has_message("Vlan 2000 not found"))
    def test_fails_when_the_vlan_does_not_exist(self):
        with self.assertRaises(UnknownVlan)as expect:
            self.client.get_vlan_interfaces(2000)

        assert_that(expect.exception, has_message("Vlan 2000 not found"))
Example #7
0
    def test_fails_with_a_wrong_name(self):
        with self.assertRaises(BadVlanName) as expect:
            self.client.add_vlan(1000, name="A space isn't good")

        assert_that(expect.exception, has_message("Vlan name is invalid"))
Example #8
0
    def test_fails_with_a_wrong_number(self):
        with self.assertRaises(BadVlanNumber) as expect:
            self.client.add_vlan(9001)

        assert_that(expect.exception, has_message("Vlan number is invalid"))
Example #9
0
    def test_fails_if_the_vlan_does_not_exist(self):
        with self.assertRaises(UnknownVlan) as expect:
            self.client.unset_vlan_load_interval(1000)

        assert_that(expect.exception, has_message("Vlan 1000 not found"))
Example #10
0
    def test_raises_UnknownVlan_when_operating_on_a_vlan_that_does_not_exist(self):
        with self.assertRaises(UnknownVlan) as expect:
            self.client.set_vlan_icmp_redirects_state(2000, False)

        assert_that(expect.exception, has_message("Vlan 2000 not found"))
Example #11
0
    def test_fails_with_unknown_interface(self):
        with self.assertRaises(UnknownInterface) as expect:
            self.client.unset_interface_state('ge-0/0/1nonexistent2000')

        assert_that(expect.exception,
                    has_message("Unknown interface ge-0/0/1nonexistent2000"))
    def test_fails_if_the_interface_does_not_exist(self):
        with self.assertRaises(UnknownInterface) as expect:
            self.client.set_interface_mtu('ge-0/0/128', 5000)

        assert_that(expect.exception, has_message("Unknown interface ge-0/0/128"))
    def test_fails_with_unknown_interface(self):
        with self.assertRaises(UnknownInterface) as expect:
            self.client.unset_interface_state('ge-0/0/1nonexistent2000')

        assert_that(expect.exception, has_message("Unknown interface ge-0/0/1nonexistent2000"))
Example #14
0
    def test_getinterface_nonexistent_raises(self):
        with self.assertRaises(UnknownInterface)as expect:
            self.client.get_interface('ethernet 1/nonexistent2000')

        assert_that(expect.exception, has_message("Unknown interface ethernet 1/nonexistent2000"))
Example #15
0
    def test_fails_when_the_vlan_does_not_exist(self):
        with self.assertRaises(UnknownVlan) as expect:
            self.client.get_vlan(2000)

        assert_that(expect.exception, has_message("Vlan 2000 not found"))
Example #16
0
    def test_fails_if_the_vlan_does_not_exist(self):
        with self.assertRaises(UnknownVlan) as expect:
            self.client.set_vlan_mpls_ip_state(1000, False)

        assert_that(expect.exception, has_message("Vlan 1000 not found"))
    def test_fails_if_the_interface_does_not_exist(self):
        with self.assertRaises(UnknownInterface) as expect:
            self.client.unset_interface_auto_negotiation_state('ge-0/0/128')

        assert_that(expect.exception, has_message("Unknown interface ge-0/0/128"))
    def test_fails_if_the_interface_does_not_exist(self):
        with self.assertRaises(UnknownInterface) as expect:
            self.client.unset_interface_mtu('ge-0/0/128')

        assert_that(expect.exception,
                    has_message("Unknown interface ge-0/0/128"))