コード例 #1
0
    def testSetupNetworksAddOverExistingBond(self, bridged=True):
        with dummyIf(2) as nics:
            status, msg = self.vdsm_net.setupNetworks(
                {}, {BONDING_NAME: {
                    'nics': nics
                }}, {'connectivityCheck': False})
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.bondExists(BONDING_NAME, nics))

            status, msg = self.vdsm_net.setupNetworks(
                {
                    NETWORK_NAME: {
                        'bonding': BONDING_NAME,
                        'bridged': bridged,
                        'vlan': VLAN_ID
                    }
                }, {}, {'connectivityCheck': False})
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME, bridged))

            status, msg = self.vdsm_net.setupNetworks(
                {NETWORK_NAME: {
                    'remove': True
                }}, {}, {'connectivityCheck': False})
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.bondExists(BONDING_NAME, nics))

            status, msg = self.vdsm_net.setupNetworks(
                {}, {BONDING_NAME: {
                    'remove': True
                }}, {'connectivityCheck': False})
            self.assertEqual(status, SUCCESS, msg)
コード例 #2
0
    def testSetupNetworksAddBondWithManyVlans(self, bridged):
        VLAN_COUNT = 5
        network_names = [NETWORK_NAME + str(tag) for tag in range(VLAN_COUNT)]
        with dummyIf(2) as nics:
            networks = dict((vlan_net, {
                'vlan': str(tag),
                'bonding': BONDING_NAME,
                'bridged': bridged
            }) for tag, vlan_net in enumerate(network_names))
            bondings = {BONDING_NAME: {'nics': nics}}

            with self.vdsm_net.pinger():
                status, msg = self.vdsm_net.setupNetworks(
                    networks, bondings, {})
            self.assertEqual(status, SUCCESS, msg)
            for vlan_net in network_names:
                self.assertTrue(self.vdsm_net.networkExists(vlan_net, bridged))
                self.assertTrue(self.vdsm_net.bondExists(BONDING_NAME, nics))
                self.assertTrue(
                    self.vdsm_net.vlanExists(BONDING_NAME + '.' +
                                             networks[vlan_net]['vlan']))

            with self.vdsm_net.pinger():
                for vlan_net in network_names:
                    status, msg = self.vdsm_net.setupNetworks(
                        {vlan_net: {
                            'remove': True
                        }}, {}, {})
                    self.assertEqual(status, SUCCESS, msg)
                    self.assertFalse(
                        self.vdsm_net.networkExists(vlan_net, bridged))
                    self.assertFalse(
                        self.vdsm_net.vlanExists(BONDING_NAME + '.' +
                                                 networks[vlan_net]['vlan']))
コード例 #3
0
ファイル: networkTests.py プロジェクト: hackxay/vdsm
    def testSetupNetworksAddOverExistingBond(self, bridged=True):
        with dummyIf(2) as nics:
            status, msg = self.vdsm_net.setupNetworks(
                {}, {BONDING_NAME: {'nics': nics}},
                {'connectivityCheck': False})
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.bondExists(BONDING_NAME, nics))

            status, msg = self.vdsm_net.setupNetworks(
                {NETWORK_NAME:
                    {'bonding': BONDING_NAME, 'bridged': bridged,
                     'vlan': VLAN_ID}},
                {}, {'connectivityCheck': False})
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME, bridged))

            status, msg = self.vdsm_net.setupNetworks(
                {NETWORK_NAME: {'remove': True}},
                {}, {'connectivityCheck': False})
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.bondExists(BONDING_NAME, nics))

            status, msg = self.vdsm_net.setupNetworks(
                {},
                {BONDING_NAME: {'remove': True}}, {'connectivityCheck': False})
            self.assertEqual(status, SUCCESS, msg)
コード例 #4
0
    def testAddNetworkBondWithManyVlans(self, bridged):
        with dummyIf(1) as nics:
            VLAN_COUNT = 5
            NET_VLANS = [(NETWORK_NAME + str(index), str(index))
                         for index in range(VLAN_COUNT)]
            for net_vlan, vlan_id in NET_VLANS:
                opts = dict(bridged=bridged)
                status, msg = self.vdsm_net.addNetwork(net_vlan,
                                                       vlan=vlan_id,
                                                       bond=BONDING_NAME,
                                                       nics=nics,
                                                       opts=opts)
                self.assertEquals(status, SUCCESS, msg)
                self.assertTrue(
                    self.vdsm_net.networkExists(net_vlan, bridged=bridged))
            for _, vlan_id in NET_VLANS:
                msg = "vlan %s doesn't exist" % vlan_id
                vlan_name = '%s.%s' % (BONDING_NAME, vlan_id)
                self.assertTrue(self.vdsm_net.vlanExists(vlan_name), msg)

            for net_vlan, vlan_id in NET_VLANS:
                status, msg = self.vdsm_net.delNetwork(net_vlan,
                                                       vlan=vlan_id,
                                                       bond=BONDING_NAME,
                                                       nics=nics)
                self.assertEqual(status, SUCCESS, msg)
コード例 #5
0
    def testSetupNetworksAddManyVlans(self, bridged):
        VLAN_COUNT = 5
        NET_VLANS = [(NETWORK_NAME + str(index), str(index))
                     for index in range(VLAN_COUNT)]

        with dummyIf(1) as nics:
            nic, = nics
            networks = dict((vlan_net, {
                'vlan': str(tag),
                'nic': nic,
                'bridged': bridged
            }) for vlan_net, tag in NET_VLANS)

            with self.vdsm_net.pinger():
                status, msg = self.vdsm_net.setupNetworks(networks, {}, {})
                self.assertEqual(status, SUCCESS, msg)

                for vlan_net, tag in NET_VLANS:
                    self.assertTrue(
                        self.vdsm_net.networkExists(vlan_net, bridged))
                    self.assertTrue(self.vdsm_net.vlanExists(nic + '.' + tag))

                networks = dict((vlan_net, {
                    'remove': True
                }) for vlan_net, _ in NET_VLANS)
                status, msg = self.vdsm_net.setupNetworks(networks, {}, {})

                self.assertEqual(status, SUCCESS, msg)

                for vlan_net, tag in NET_VLANS:
                    self.assertFalse(
                        self.vdsm_net.networkExists(vlan_net, bridged))
                    self.assertFalse(self.vdsm_net.vlanExists(nic + '.' + tag))
コード例 #6
0
 def testEditWithoutAdd(self, bridged):
     with dummyIf(1) as nics:
         status, msg = self.vdsm_net.editNetwork(NETWORK_NAME,
                                                 NETWORK_NAME,
                                                 nics=nics,
                                                 opts={'bridged': bridged})
         self.assertEqual(status, neterrors.ERR_BAD_BRIDGE, msg)
コード例 #7
0
    def testSetupNetworksAddManyVlans(self, bridged):
        VLAN_COUNT = 5
        NET_VLANS = [(NETWORK_NAME + str(index), str(index)) for index in range(VLAN_COUNT)]

        with dummyIf(1) as nics:
            nic, = nics
            networks = dict(
                (vlan_net, {"vlan": str(tag), "nic": nic, "bridged": bridged}) for vlan_net, tag in NET_VLANS
            )

            with self.vdsm_net.pinger():
                status, msg = self.vdsm_net.setupNetworks(networks, {}, {})
                self.assertEqual(status, SUCCESS, msg)

                for vlan_net, tag in NET_VLANS:
                    self.assertTrue(self.vdsm_net.networkExists(vlan_net, bridged))
                    self.assertTrue(self.vdsm_net.vlanExists(nic + "." + tag))

                networks = dict((vlan_net, {"remove": True}) for vlan_net, _ in NET_VLANS)
                status, msg = self.vdsm_net.setupNetworks(networks, {}, {})

                self.assertEqual(status, SUCCESS, msg)

                for vlan_net, tag in NET_VLANS:
                    self.assertFalse(self.vdsm_net.networkExists(vlan_net, bridged))
                    self.assertFalse(self.vdsm_net.vlanExists(nic + "." + tag))
コード例 #8
0
ファイル: networkTests.py プロジェクト: hackxay/vdsm
    def testSetupNetworksAddBondWithManyVlans(self, bridged):
        VLAN_COUNT = 5
        network_names = [NETWORK_NAME + str(tag) for tag in range(VLAN_COUNT)]
        with dummyIf(2) as nics:
            networks = dict((vlan_net,
                             {'vlan': str(tag), 'bonding': BONDING_NAME,
                              'bridged': bridged})
                            for tag, vlan_net in enumerate(network_names))
            bondings = {BONDING_NAME: {'nics': nics}}

            with self.vdsm_net.pinger():
                status, msg = self.vdsm_net.setupNetworks(networks, bondings,
                                                          {})
            self.assertEqual(status, SUCCESS, msg)
            for vlan_net in network_names:
                self.assertTrue(self.vdsm_net.networkExists(vlan_net, bridged))
                self.assertTrue(self.vdsm_net.bondExists(BONDING_NAME, nics))
                self.assertTrue(self.vdsm_net.vlanExists(BONDING_NAME + '.' +
                                networks[vlan_net]['vlan']))

            with self.vdsm_net.pinger():
                for vlan_net in network_names:
                    status, msg = self.vdsm_net.setupNetworks(
                        {vlan_net: {'remove': True}}, {}, {})
                    self.assertEqual(status, SUCCESS, msg)
                    self.assertFalse(self.vdsm_net.networkExists(NETWORK_NAME))
コード例 #9
0
 def testFailWithInvalidBondingName(self, bridged):
     with dummyIf(1) as nics:
         invalid_bond_names = ("bond", "bonda", "bond0a", "jamesbond007")
         for bond_name in invalid_bond_names:
             status, msg = self.vdsm_net.addNetwork(
                 NETWORK_NAME, bond=bond_name, nics=nics, opts={"bridged": bridged}
             )
             self.assertEqual(status, neterrors.ERR_BAD_BONDING, msg)
コード例 #10
0
    def testAddDelNetwork(self, bridged):
        with dummyIf(1) as nics:
            status, msg = self.vdsm_net.addNetwork(NETWORK_NAME, nics=nics, opts={"bridged": bridged})
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME))

            status, msg = self.vdsm_net.delNetwork(NETWORK_NAME, nics=nics, opts={"bridged": bridged})
            self.assertEqual(status, SUCCESS, msg)
            self.assertFalse(self.vdsm_net.networkExists(NETWORK_NAME))
コード例 #11
0
 def testAddNetworkVlanBond(self, bridged):
     with dummyIf(1) as nics:
         vlan_id = "42"
         status, msg = self.vdsm_net.addNetwork(
             NETWORK_NAME, vlan=vlan_id, bond=BONDING_NAME, nics=nics, opts={"bridged": bridged}
         )
         self.assertEquals(status, SUCCESS, msg)
         self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME, bridged=bridged))
         status, msg = self.vdsm_net.delNetwork(NETWORK_NAME, vlan=vlan_id, bond=BONDING_NAME, nics=nics)
         self.assertEqual(status, SUCCESS, msg)
コード例 #12
0
    def testTwiceAdd(self, bridged):
        with dummyIf(1) as nics:
            status, msg = self.vdsm_net.addNetwork(NETWORK_NAME, nics=nics, opts={"bridged": bridged})
            self.assertEqual(status, SUCCESS, msg)

            status, msg = self.vdsm_net.addNetwork(NETWORK_NAME, nics=nics)
            self.assertEqual(status, neterrors.ERR_USED_BRIDGE, msg)

            status, msg = self.vdsm_net.delNetwork(NETWORK_NAME)
            self.assertEqual(status, SUCCESS, msg)
コード例 #13
0
 def testFailWithInvalidBondingName(self, bridged):
     with dummyIf(1) as nics:
         invalid_bond_names = ('bond', 'bonda', 'bond0a', 'jamesbond007')
         for bond_name in invalid_bond_names:
             status, msg = self.vdsm_net.addNetwork(
                 NETWORK_NAME,
                 bond=bond_name,
                 nics=nics,
                 opts={'bridged': bridged})
             self.assertEqual(status, neterrors.ERR_BAD_BONDING, msg)
コード例 #14
0
ファイル: networkTests.py プロジェクト: hackxay/vdsm
    def testQosNetwork(self):
        with dummyIf(1) as nics:
            qos = {'qosInbound': {'average': '1024', 'burst': '2048'},
                   'qosOutbound': {'average': '2400', 'burst': '2048',
                                   'peak': '100'}}

            status, msg = self.vdsm_net.addNetwork(NETWORK_NAME,
                                                   nics=nics,
                                                   opts=qos)

            self.assertEqual(status, SUCCESS, msg)
コード例 #15
0
    def testAddNetworkVlan(self, bridged):
        with dummyIf(1) as nics:
            status, msg = self.vdsm_net.addNetwork(
                NETWORK_NAME, vlan=VLAN_ID, nics=nics, opts={"bridged": bridged, "STP": "off"}
            )
            self.assertEquals(status, SUCCESS, msg)

            self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME, bridged=bridged))
            self.assertTrue(self.vdsm_net.vlanExists(nics[0] + "." + VLAN_ID))

            self.vdsm_net.delNetwork(NETWORK_NAME)
            self.assertEquals(status, SUCCESS, msg)
コード例 #16
0
    def testTwiceAdd(self, bridged):
        with dummyIf(1) as nics:
            status, msg = self.vdsm_net.addNetwork(NETWORK_NAME,
                                                   nics=nics,
                                                   opts={'bridged': bridged})
            self.assertEqual(status, SUCCESS, msg)

            status, msg = self.vdsm_net.addNetwork(NETWORK_NAME, nics=nics)
            self.assertEqual(status, neterrors.ERR_USED_BRIDGE, msg)

            status, msg = self.vdsm_net.delNetwork(NETWORK_NAME)
            self.assertEqual(status, SUCCESS, msg)
コード例 #17
0
    def testAddDelNetwork(self, bridged):
        with dummyIf(1) as nics:
            status, msg = self.vdsm_net.addNetwork(NETWORK_NAME,
                                                   nics=nics,
                                                   opts={'bridged': bridged})
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME))

            status, msg = self.vdsm_net.delNetwork(NETWORK_NAME,
                                                   nics=nics,
                                                   opts={'bridged': bridged})
            self.assertEqual(status, SUCCESS, msg)
            self.assertFalse(self.vdsm_net.networkExists(NETWORK_NAME))
コード例 #18
0
    def testQosNetwork(self):
        with dummyIf(1) as nics:
            qos = {
                "qosInbound": {"average": "1024", "burst": "2048", "peak": "42"},
                "qosOutbound": {"average": "2400", "burst": "2048", "peak": "100"},
            }

            status, msg = self.vdsm_net.addNetwork(NETWORK_NAME, nics=nics, opts=qos)
            self.assertEqual(status, SUCCESS, msg)

            qosInbound, qosOutbound = self.vdsm_net.networkQos(NETWORK_NAME)
            self.assertEqual(qos["qosInbound"], qosInbound)
            self.assertEqual(qos["qosOutbound"], qosOutbound)
コード例 #19
0
    def testSetupNetworksAddVlan(self, bridged):
        with dummyIf(1) as nics:
            with self.vdsm_net.pinger():
                nic, = nics
                attrs = dict(vlan=VLAN_ID, nic=nic, bridged=bridged)
                status, msg = self.vdsm_net.setupNetworks({NETWORK_NAME: attrs}, {}, {})

                self.assertEqual(status, SUCCESS, msg)
                self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME))
                self.assertTrue(self.vdsm_net.vlanExists("%s.%s" % (nic, VLAN_ID)))

                status, msg = self.vdsm_net.setupNetworks({NETWORK_NAME: dict(remove=True)}, {}, {})
                self.assertEqual(status, SUCCESS, msg)
コード例 #20
0
ファイル: networkTests.py プロジェクト: hackxay/vdsm
    def testAddDelBondedNetwork(self, bridged):
        with dummyIf(2) as nics:
            status, msg = self.vdsm_net.addNetwork(NETWORK_NAME,
                                                   bond=BONDING_NAME,
                                                   nics=nics,
                                                   opts={'bridged': bridged})
            self.assertEqual(status, SUCCESS, msg)

            self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME, bridged))
            self.assertTrue(self.vdsm_net.bondExists(BONDING_NAME, nics))

            status, msg = self.vdsm_net.delNetwork(NETWORK_NAME)
            self.assertEqual(status, SUCCESS, msg)
            self.assertFalse(self.vdsm_net.networkExists(NETWORK_NAME))
コード例 #21
0
    def testAddNetworkManyVlans(self, bridged):
        with dummyIf(1) as nics:
            VLAN_COUNT = 5
            NET_VLANS = [(NETWORK_NAME + str(index), str(index)) for index in range(VLAN_COUNT)]
            for net_vlan, vlan_id in NET_VLANS:
                opts = {"bridged": bridged}
                status, msg = self.vdsm_net.addNetwork(net_vlan, vlan=vlan_id, nics=nics, opts=opts)
                self.assertEquals(status, SUCCESS, msg)

            for net_vlan, vlan_id in NET_VLANS:
                self.assertTrue(self.vdsm_net.networkExists(net_vlan, bridged=bridged))
                self.assertTrue(self.vdsm_net.vlanExists(nics[0] + "." + str(vlan_id)))

                self.vdsm_net.delNetwork(net_vlan)
                self.assertEquals(status, SUCCESS, msg)
コード例 #22
0
    def testSetupNetworksAddVlan(self, bridged):
        with dummyIf(1) as nics:
            with self.vdsm_net.pinger():
                nic, = nics
                attrs = dict(vlan=VLAN_ID, nic=nic, bridged=bridged)
                status, msg = self.vdsm_net.setupNetworks(
                    {NETWORK_NAME: attrs}, {}, {})

                self.assertEqual(status, SUCCESS, msg)
                self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME))
                self.assertTrue(
                    self.vdsm_net.vlanExists('%s.%s' % (nic, VLAN_ID)))

                status, msg = self.vdsm_net.setupNetworks(
                    {NETWORK_NAME: dict(remove=True)}, {}, {})
                self.assertEqual(status, SUCCESS, msg)
コード例 #23
0
 def testAddNetworkVlanBond(self, bridged):
     with dummyIf(1) as nics:
         vlan_id = '42'
         status, msg = self.vdsm_net.addNetwork(NETWORK_NAME,
                                                vlan=vlan_id,
                                                bond=BONDING_NAME,
                                                nics=nics,
                                                opts={'bridged': bridged})
         self.assertEquals(status, SUCCESS, msg)
         self.assertTrue(
             self.vdsm_net.networkExists(NETWORK_NAME, bridged=bridged))
         status, msg = self.vdsm_net.delNetwork(NETWORK_NAME,
                                                vlan=vlan_id,
                                                bond=BONDING_NAME,
                                                nics=nics)
         self.assertEqual(status, SUCCESS, msg)
コード例 #24
0
    def testDelNetworkWithMTU(self, bridged):
        MTU = "1234"
        with dummyIf(1) as nics:
            status, msg = self.vdsm_net.addNetwork(
                NETWORK_NAME, vlan=VLAN_ID, bond=BONDING_NAME, nics=nics, opts={"MTU": MTU, "bridged": bridged}
            )
            vlan_name = "%s.%s" % (BONDING_NAME, VLAN_ID)

            self.assertEqual(status, SUCCESS, msg)
            self.assertEquals(MTU, self.vdsm_net.getMtu(NETWORK_NAME))
            self.assertEquals(MTU, self.vdsm_net.getMtu(vlan_name))
            self.assertEquals(MTU, self.vdsm_net.getMtu(BONDING_NAME))
            self.assertEquals(MTU, self.vdsm_net.getMtu(nics[0]))

            status, msg = self.vdsm_net.delNetwork(NETWORK_NAME)
            self.assertEqual(status, SUCCESS, msg)
コード例 #25
0
    def testSetupNetworksAddDelBondedNetwork(self, bridged):
        with dummyIf(2) as nics:
            with self.vdsm_net.pinger():
                status, msg = self.vdsm_net.setupNetworks(
                    {NETWORK_NAME: {"bonding": BONDING_NAME, "bridged": bridged}},
                    {BONDING_NAME: {"nics": nics, "options": "mode=2"}},
                    {},
                )
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME, bridged))
            self.assertTrue(self.vdsm_net.bondExists(BONDING_NAME, nics))

            with self.vdsm_net.pinger():
                status, msg = self.vdsm_net.setupNetworks({NETWORK_NAME: {"remove": True}}, {}, {})
            self.assertEqual(status, SUCCESS, msg)
            self.assertFalse(self.vdsm_net.networkExists(NETWORK_NAME))
コード例 #26
0
ファイル: networkTests.py プロジェクト: hackxay/vdsm
    def testSetupNetworksAddDelBondedNetwork(self, bridged):
        with dummyIf(2) as nics:
            with self.vdsm_net.pinger():
                status, msg = self.vdsm_net.setupNetworks(
                    {NETWORK_NAME:
                        {'bonding': BONDING_NAME, 'bridged': bridged}},
                    {BONDING_NAME: {'nics': nics, 'options': 'mode=2'}}, {})
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME, bridged))
            self.assertTrue(self.vdsm_net.bondExists(BONDING_NAME, nics))

            with self.vdsm_net.pinger():
                status, msg = self.vdsm_net.setupNetworks(
                    {NETWORK_NAME: {'remove': True}}, {}, {})
            self.assertEqual(status, SUCCESS, msg)
            self.assertFalse(self.vdsm_net.networkExists(NETWORK_NAME))
コード例 #27
0
    def testAddNetworkBondWithManyVlans(self, bridged):
        with dummyIf(1) as nics:
            VLAN_COUNT = 5
            NET_VLANS = [(NETWORK_NAME + str(index), str(index)) for index in range(VLAN_COUNT)]
            for net_vlan, vlan_id in NET_VLANS:
                opts = dict(bridged=bridged)
                status, msg = self.vdsm_net.addNetwork(net_vlan, vlan=vlan_id, bond=BONDING_NAME, nics=nics, opts=opts)
                self.assertEquals(status, SUCCESS, msg)
                self.assertTrue(self.vdsm_net.networkExists(net_vlan, bridged=bridged))
            for _, vlan_id in NET_VLANS:
                msg = "vlan %s doesn't exist" % vlan_id
                vlan_name = "%s.%s" % (BONDING_NAME, vlan_id)
                self.assertTrue(self.vdsm_net.vlanExists(vlan_name), msg)

            for net_vlan, vlan_id in NET_VLANS:
                status, msg = self.vdsm_net.delNetwork(net_vlan, vlan=vlan_id, bond=BONDING_NAME, nics=nics)
                self.assertEqual(status, SUCCESS, msg)
コード例 #28
0
    def testAddNetworkVlan(self, bridged):
        with dummyIf(1) as nics:
            status, msg = self.vdsm_net.addNetwork(NETWORK_NAME,
                                                   vlan=VLAN_ID,
                                                   nics=nics,
                                                   opts={
                                                       'bridged': bridged,
                                                       'STP': 'off'
                                                   })
            self.assertEquals(status, SUCCESS, msg)

            self.assertTrue(
                self.vdsm_net.networkExists(NETWORK_NAME, bridged=bridged))
            self.assertTrue(self.vdsm_net.vlanExists(nics[0] + '.' + VLAN_ID))

            self.vdsm_net.delNetwork(NETWORK_NAME)
            self.assertEquals(status, SUCCESS, msg)
コード例 #29
0
    def testDelNetworkWithMTU(self, bridged):
        MTU = '1234'
        with dummyIf(1) as nics:
            status, msg = self.vdsm_net.addNetwork(NETWORK_NAME,
                                                   vlan=VLAN_ID,
                                                   bond=BONDING_NAME,
                                                   nics=nics,
                                                   opts={
                                                       'MTU': MTU,
                                                       'bridged': bridged
                                                   })
            vlan_name = '%s.%s' % (BONDING_NAME, VLAN_ID)

            self.assertEqual(status, SUCCESS, msg)
            self.assertEquals(MTU, self.vdsm_net.getMtu(NETWORK_NAME))
            self.assertEquals(MTU, self.vdsm_net.getMtu(vlan_name))
            self.assertEquals(MTU, self.vdsm_net.getMtu(BONDING_NAME))
            self.assertEquals(MTU, self.vdsm_net.getMtu(nics[0]))

            status, msg = self.vdsm_net.delNetwork(NETWORK_NAME)
            self.assertEqual(status, SUCCESS, msg)
コード例 #30
0
    def testAddNetworkManyVlans(self, bridged):
        with dummyIf(1) as nics:
            VLAN_COUNT = 5
            NET_VLANS = [(NETWORK_NAME + str(index), str(index))
                         for index in range(VLAN_COUNT)]
            for net_vlan, vlan_id in NET_VLANS:
                opts = {'bridged': bridged}
                status, msg = self.vdsm_net.addNetwork(net_vlan,
                                                       vlan=vlan_id,
                                                       nics=nics,
                                                       opts=opts)
                self.assertEquals(status, SUCCESS, msg)

            for net_vlan, vlan_id in NET_VLANS:
                self.assertTrue(
                    self.vdsm_net.networkExists(net_vlan, bridged=bridged))
                self.assertTrue(
                    self.vdsm_net.vlanExists(nics[0] + '.' + str(vlan_id)))

                self.vdsm_net.delNetwork(net_vlan)
                self.assertEquals(status, SUCCESS, msg)
コード例 #31
0
    def testQosNetwork(self):
        with dummyIf(1) as nics:
            qos = {
                'qosInbound': {
                    'average': '1024',
                    'burst': '2048',
                    'peak': '42'
                },
                'qosOutbound': {
                    'average': '2400',
                    'burst': '2048',
                    'peak': '100'
                }
            }

            status, msg = self.vdsm_net.addNetwork(NETWORK_NAME,
                                                   nics=nics,
                                                   opts=qos)
            self.assertEqual(status, SUCCESS, msg)

            qosInbound, qosOutbound = self.vdsm_net.networkQos(NETWORK_NAME)
            self.assertEqual(qos['qosInbound'], qosInbound)
            self.assertEqual(qos['qosOutbound'], qosOutbound)
コード例 #32
0
    def testSetupNetworksAddDelBondedNetwork(self, bridged):
        with dummyIf(2) as nics:
            with self.vdsm_net.pinger():
                status, msg = self.vdsm_net.setupNetworks(
                    {
                        NETWORK_NAME: {
                            'bonding': BONDING_NAME,
                            'bridged': bridged
                        }
                    }, {BONDING_NAME: {
                        'nics': nics,
                        'options': 'mode=2'
                    }}, {})
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME, bridged))
            self.assertTrue(self.vdsm_net.bondExists(BONDING_NAME, nics))

            with self.vdsm_net.pinger():
                status, msg = self.vdsm_net.setupNetworks(
                    {NETWORK_NAME: {
                        'remove': True
                    }}, {}, {})
            self.assertEqual(status, SUCCESS, msg)
            self.assertFalse(self.vdsm_net.networkExists(NETWORK_NAME))
コード例 #33
0
    def testSetupNetworksAddOverExistingBond(self, bridged=True):
        with dummyIf(2) as nics:
            status, msg = self.vdsm_net.setupNetworks({}, {BONDING_NAME: {"nics": nics}}, {"connectivityCheck": False})
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.bondExists(BONDING_NAME, nics))

            status, msg = self.vdsm_net.setupNetworks(
                {NETWORK_NAME: {"bonding": BONDING_NAME, "bridged": bridged, "vlan": VLAN_ID}},
                {},
                {"connectivityCheck": False},
            )
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.networkExists(NETWORK_NAME, bridged))

            status, msg = self.vdsm_net.setupNetworks(
                {NETWORK_NAME: {"remove": True}}, {}, {"connectivityCheck": False}
            )
            self.assertEqual(status, SUCCESS, msg)
            self.assertTrue(self.vdsm_net.bondExists(BONDING_NAME, nics))

            status, msg = self.vdsm_net.setupNetworks(
                {}, {BONDING_NAME: {"remove": True}}, {"connectivityCheck": False}
            )
            self.assertEqual(status, SUCCESS, msg)
コード例 #34
0
 def testEditWithoutAdd(self, bridged):
     with dummyIf(1) as nics:
         status, msg = self.vdsm_net.editNetwork(NETWORK_NAME, NETWORK_NAME, nics=nics, opts={"bridged": bridged})
         self.assertEqual(status, neterrors.ERR_BAD_BRIDGE, msg)