def test_split_bonds(self): bond_query = {'bond2add': {'nics': ['eth0', 'eth1']}, 'bond2edit': {'nics': ['eth2', 'eth3']}, 'bond2remove': {'remove': True}} running_bonds = {'bond2edit': {'foo': 'bar'}} bonds2add, bonds2edit, bonds2remove = netswitch._split_setup_actions( bond_query, running_bonds) self.assertEqual(bonds2add, {'bond2add': {'nics': ['eth0', 'eth1']}}) self.assertEqual(bonds2edit, {'bond2edit': {'nics': ['eth2', 'eth3']}}) self.assertEqual(bonds2remove, {'bond2remove': {'remove': True}})
def test_split_nets(self): net_query = {'net2add': {'nic': 'eth0'}, 'net2edit': {'nic': 'eth1'}, 'net2remove': {'remove': True}} running_nets = {'net2edit': {'foo': 'bar'}} nets2add, nets2edit, nets2remove = netswitch._split_setup_actions( net_query, running_nets) self.assertEqual(nets2add, {'net2add': {'nic': 'eth0'}}) self.assertEqual(nets2edit, {'net2edit': {'nic': 'eth1'}}) self.assertEqual(nets2remove, {'net2remove': {'remove': True}})
def test_split_bonds(self): bond_query = { 'bond2add': { 'nics': ['eth0', 'eth1'] }, 'bond2edit': { 'nics': ['eth2', 'eth3'] }, 'bond2remove': { 'remove': True } } running_bonds = {'bond2edit': {'foo': 'bar'}} bonds2add, bonds2edit, bonds2remove = netswitch._split_setup_actions( bond_query, running_bonds) self.assertEqual(bonds2add, {'bond2add': {'nics': ['eth0', 'eth1']}}) self.assertEqual(bonds2edit, {'bond2edit': {'nics': ['eth2', 'eth3']}}) self.assertEqual(bonds2remove, {'bond2remove': {'remove': True}})
def test_split_nets(self): net_query = { 'net2add': { 'nic': 'eth0' }, 'net2edit': { 'nic': 'eth1' }, 'net2remove': { 'remove': True } } running_nets = {'net2edit': {'foo': 'bar'}} nets2add, nets2edit, nets2remove = netswitch._split_setup_actions( net_query, running_nets) self.assertEqual(nets2add, {'net2add': {'nic': 'eth0'}}) self.assertEqual(nets2edit, {'net2edit': {'nic': 'eth1'}}) self.assertEqual(nets2remove, {'net2remove': {'remove': True}})