def test_check_untagged_intersection(self): cluster = self.env.create(nodes_kwargs=[{ 'roles': ['controller'], 'pending_addition': True }]) cluster_db = self.db.query(Cluster).get(cluster['id']) checker = NetworkCheck(FakeTask(cluster_db), {}) checker.networks = [{ 'id': 1, 'cidr': '192.168.0.0/24', 'name': 'fake1', 'vlan_start': None, 'meta': { 'notation': 'cidr' } }] ng1 = NetworkGroup() ng1.name = 'fake3' ng1.id = 3 ng2 = NetworkGroup() ng2.name = 'fake4' ng2.id = 4 checker.cluster.nodes[0].interfaces[0].assigned_networks_list = \ [ng1, ng2] self.assertNotRaises(errors.NetworkCheckError, checker.check_untagged_intersection)
def test_check_untagged_intersection_failed(self, mocked_db): cluster = self.env.create( nodes_kwargs=[ {'roles': ['controller'], 'pending_addition': True} ] ) cluster_db = self.db.query(Cluster).get(cluster['id']) checker = NetworkCheck(FakeTask(cluster_db), {}) checker.networks = [{'id': 1, 'cidr': '192.168.0.0/24', 'name': consts.NETWORKS.storage, 'vlan_start': None, 'meta': {'notation': 'cidr'}}, {'id': 2, 'cidr': '192.168.0.0/26', 'name': consts.NETWORKS.management, 'vlan_start': None, 'meta': {'notation': 'cidr'}}] ng1 = NetworkGroup() ng1.name = consts.NETWORKS.storage ng1.id = 1 ng2 = NetworkGroup() ng2.name = consts.NETWORKS.management ng2.id = 2 checker.cluster.nodes[0].interfaces[0].assigned_networks_list = \ [ng1, ng2] checker.cluster.nodes[0].interfaces[1].assigned_networks_list = \ [ng1, ng2] self.env.db.flush() self.assertRaises(errors.NetworkCheckError, checker.check_untagged_intersection)
def test_check_untagged_intersection_failed(self, mocked_db): cluster = self.env.create(nodes_kwargs=[{"roles": ["controller"], "pending_addition": True}]) cluster_db = self.db.query(Cluster).get(cluster["id"]) checker = NetworkCheck(FakeTask(cluster_db), {}) checker.networks = [ { "id": 1, "cidr": "192.168.0.0/24", "name": consts.NETWORKS.storage, "vlan_start": None, "meta": {"notation": "cidr"}, }, { "id": 2, "cidr": "192.168.0.0/26", "name": consts.NETWORKS.management, "vlan_start": None, "meta": {"notation": "cidr"}, }, ] ng1 = NetworkGroup() ng1.name = consts.NETWORKS.storage ng1.id = 1 ng2 = NetworkGroup() ng2.name = consts.NETWORKS.management ng2.id = 2 checker.cluster.nodes[0].interfaces[0].assigned_networks_list = [ng1, ng2] checker.cluster.nodes[0].interfaces[1].assigned_networks_list = [ng1, ng2] self.env.db.flush() self.assertRaises(errors.NetworkCheckError, checker.check_untagged_intersection)
def test_check_untagged_intersection(self): cluster = self.env.create(nodes_kwargs=[{"roles": ["controller"], "pending_addition": True}]) cluster_db = self.db.query(Cluster).get(cluster["id"]) checker = NetworkCheck(FakeTask(cluster_db), {}) checker.networks = [ {"id": 1, "cidr": "192.168.0.0/24", "name": "fake1", "vlan_start": None, "meta": {"notation": "cidr"}} ] ng1 = NetworkGroup() ng1.name = "fake3" ng1.id = 3 ng2 = NetworkGroup() ng2.name = "fake4" ng2.id = 4 checker.cluster.nodes[0].interfaces[0].assigned_networks_list = [ng1, ng2] self.assertNotRaises(errors.NetworkCheckError, checker.check_untagged_intersection)
def test_check_untagged_intersection_failed(self, mocked_db): cluster = self.env.create(nodes_kwargs=[{ 'roles': ['controller'], 'pending_addition': True }]) cluster_db = self.db.query(Cluster).get(cluster['id']) checker = NetworkCheck(FakeTask(cluster_db), {}) checker.networks = [{ 'id': 1, 'cidr': '192.168.0.0/24', 'name': consts.NETWORKS.storage, 'vlan_start': None, 'meta': { 'notation': 'cidr' } }, { 'id': 2, 'cidr': '192.168.0.0/26', 'name': consts.NETWORKS.management, 'vlan_start': None, 'meta': { 'notation': 'cidr' } }] ng1 = NetworkGroup() ng1.name = consts.NETWORKS.storage ng1.id = 1 ng2 = NetworkGroup() ng2.name = consts.NETWORKS.management ng2.id = 2 checker.cluster.nodes[0].interfaces[0].assigned_networks_list = \ [ng1, ng2] checker.cluster.nodes[0].interfaces[1].assigned_networks_list = \ [ng1, ng2] self.env.db.flush() self.assertRaises(errors.NetworkCheckError, checker.check_untagged_intersection)
def test_check_untagged_intersection(self): cluster = self.env.create( nodes_kwargs=[ {'roles': ['controller'], 'pending_addition': True} ] ) cluster_db = self.db.query(Cluster).get(cluster['id']) checker = NetworkCheck(FakeTask(cluster_db), {}) checker.networks = [{'id': 1, 'cidr': '192.168.0.0/24', 'name': 'fake1', 'vlan_start': None, 'meta': {'notation': 'cidr'}}] ng1 = NetworkGroup() ng1.name = 'fake3' ng1.id = 3 ng2 = NetworkGroup() ng2.name = 'fake4' ng2.id = 4 checker.cluster.nodes[0].interfaces[0].assigned_networks_list = \ [ng1, ng2] self.assertNotRaises(errors.NetworkCheckError, checker.check_untagged_intersection)