Esempio n. 1
0
    def testIsVlanIdValid(self):
        vlanIds = ('badValue', Vlan.MAX_ID + 1)

        for vlanId in vlanIds:
            with self.assertRaises(errors.ConfigNetworkError) as cneContext:
                Vlan.validateTag(vlanId)
            self.assertEqual(cneContext.exception.errCode, errors.ERR_BAD_VLAN)

        self.assertEqual(Vlan.validateTag(0), None)
        self.assertEqual(Vlan.validateTag(Vlan.MAX_ID), None)
Esempio n. 2
0
    def testIsVlanIdValid(self):
        vlanIds = ('badValue', Vlan.MAX_ID + 1)

        for vlanId in vlanIds:
            with pytest.raises(errors.ConfigNetworkError) as cneContext:
                Vlan.validateTag(vlanId)
            assert cneContext.value.errCode == errors.ERR_BAD_VLAN

        assert Vlan.validateTag(0) is None
        assert Vlan.validateTag(Vlan.MAX_ID) is None
Esempio n. 3
0
    def testIsVlanIdValid(self):
        vlanIds = ('badValue', Vlan.MAX_ID + 1)

        for vlanId in vlanIds:
            with self.assertRaises(errors.ConfigNetworkError) as cneContext:
                Vlan.validateTag(vlanId)
            self.assertEqual(cneContext.exception.errCode,
                             errors.ERR_BAD_VLAN)

        self.assertEqual(Vlan.validateTag(0), None)
        self.assertEqual(Vlan.validateTag(Vlan.MAX_ID), None)