예제 #1
0
    def _addNetworkWithExc(self, netName, opts, errCode):
        configurator = legacy_switch.ConfiguratorClass()

        with self.assertRaises(errors.ConfigNetworkError) as cneContext:
            canonicalize_networks({netName: opts})
            legacy_switch._add_network(netName, configurator, **opts)
        self.assertEqual(cneContext.exception.errCode, errCode)
예제 #2
0
    def _addNetworkWithExc(self, netName, opts, errCode):
        configurator = legacy_switch.ConfiguratorClass()

        with self.assertRaises(errors.ConfigNetworkError) as cneContext:
            canonicalize_networks({netName: opts})
            legacy_switch._add_network(netName, configurator, **opts)
        self.assertEqual(cneContext.exception.errCode, errCode)
예제 #3
0
    def _addNetworkWithExc(self, netName, opts, errCode):
        fakeInfo = netinfo.cache.CachingNetInfo(FAKE_NETINFO)
        configurator = ifcfg.Ifcfg(fakeInfo)

        with self.assertRaises(errors.ConfigNetworkError) as cneContext:
            canonicalize_networks({netName: opts})
            legacy_switch._add_network(netName, configurator, fakeInfo, **opts)
        self.assertEqual(cneContext.exception.errCode, errCode)
예제 #4
0
    def _addNetworkWithExc(self, netName, opts, errCode):
        fakeInfo = netinfo.cache.CachingNetInfo(FAKE_NETINFO)
        configurator = ifcfg.Ifcfg(fakeInfo)

        with pytest.raises(errors.ConfigNetworkError) as cneContext:
            canonicalize_networks({netName: opts})
            validator.validate_network_setup({netName: opts}, {}, FAKE_NETINFO)
            legacy_switch._add_network(netName, configurator, fakeInfo, None,
                                       **opts)
        assert cneContext.value.errCode == errCode