def test_get_basic_list_config_bgp_by_search(self): """Test GET ListConfigBGP with kind=basic by search.""" lists_config_bgp_path = self.json_path.format('pk_1_basic.json') search = { 'start_record': 0, 'end_record': 25, 'asorting_cols': [], 'searchable_columns': [], 'extends_search': [{ 'name': 'test_1' }] } uri = mount_url(self.list_config_bgp_uri, kind=['basic'], search=search, fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json_lists(lists_config_bgp_path, response.data['lists_config_bgp'])
def test_put_peer_groups(self): """Test PUT PeerGroups.""" peer_groups_path = self.json_path.\ format('one_peer_group.json') response = self.client.put( self.peer_group_uri, data=self.load_json(peer_groups_path), content_type=self.content_type, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) get_ids = [data['id'] for data in response.data] uri = mount_url(self.peer_group_uri, get_ids, fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json(peer_groups_path, response.data)
def test_get_basic_route_map_entry_by_search(self): """Test GET RouteMapEntry with kind=basic by search.""" route_map_entries_path = self.json_path.format('pk_1_basic.json') search = { 'start_record': 0, 'end_record': 25, 'asorting_cols': [], 'searchable_columns': [], 'extends_search': [{ 'order': 5 }] } uri = mount_url(self.route_map_entry_uri, kind=['basic'], search=search, fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json_lists(route_map_entries_path, response.data['route_map_entries'])
def test_post_lists_config_bgp(self): """Test POST ListsConfigBGP.""" lists_config_bgp_path = self.json_path.\ format('two_lists_config_bgp.json') response = self.client.post( self.list_config_bgp_uri, data=self.load_json(lists_config_bgp_path), content_type=self.content_type, HTTP_AUTHORIZATION=self.authorization) self.compare_status(201, response.status_code) get_ids = [data['id'] for data in response.data] uri = mount_url(self.list_config_bgp_uri, get_ids, kind=['basic'], fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json(lists_config_bgp_path, response.data)
def test_get_basic_peer_group_by_search(self): """Test GET PeerGroup with kind=basic by search.""" peer_groups_path = self.json_path.format('pk_1_basic.json') search = { 'start_record': 0, 'end_record': 25, 'asorting_cols': [], 'searchable_columns': [], 'extends_search': [{ 'route_map_in': 1 }] } uri = mount_url(self.peer_group_uri, kind=['basic'], search=search, fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json_lists(peer_groups_path, response.data['peer_groups'])
def test_get_basic_route_map_entry_by_search(self): """Test GET RouteMapEntry with kind=basic by search.""" route_map_entries_path = self.json_path.format('pk_1_basic.json') search = { 'start_record': 0, 'end_record': 25, 'asorting_cols': [], 'searchable_columns': [], 'extends_search': [{ 'order': 5 }] } uri = mount_url(self.route_map_entry_uri, kind=['basic'], search=search, fields=self.fields) response = self.client.get(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) self.compare_json_lists(route_map_entries_path, response.data['route_map_entries'])
def test_post_neighbor_v6(self): """Test POST NeighborV6.""" neighbor_v6_path = self.json_path.\ format('one_neighbor_v6.json') response = self.client.post( self.neighbor_v6_uri, data=self.load_json(neighbor_v6_path), content_type=self.content_type, HTTP_AUTHORIZATION=self.authorization) self.compare_status(201, response.status_code) get_ids = [data['id'] for data in response.data] uri = mount_url(self.neighbor_v6_uri, get_ids, fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json(neighbor_v6_path, response.data)
def test_post_peer_groups(self): """Test POST PeerGroups.""" peer_groups_path = self.json_path.\ format('two_peer_groups.json') response = self.client.post( self.peer_group_uri, data=self.load_json(peer_groups_path), content_type=self.content_type, HTTP_AUTHORIZATION=self.authorization) self.compare_status(201, response.status_code) get_ids = [data['id'] for data in response.data] uri = mount_url(self.peer_group_uri, get_ids, fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json(peer_groups_path, response.data)
def test_get_basic_neighbor_v4_by_search(self): """Test GET NeighborV4 with kind=basic by search.""" neighbor_v4_path = self.json_path.format('pk_1_basic.json') search = { 'start_record': 0, 'end_record': 25, 'asorting_cols': [], 'searchable_columns': [], 'extends_search': [{ 'virtual_interface': 'test_vi' }] } uri = mount_url(self.neighbor_v4_uri, kind=['basic'], search=search, fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json_lists(neighbor_v4_path, response.data['neighbors'])
def test_post_route_maps(self): """Test POST RouteMaps.""" route_maps_path = self.json_path.\ format('two_route_maps.json') response = self.client.post( self.route_map_uri, data=self.load_json(route_maps_path), content_type=self.content_type, HTTP_AUTHORIZATION=self.authorization) self.compare_status(201, response.status_code) get_ids = [data['id'] for data in response.data] uri = mount_url(self.route_map_uri, get_ids, kind=['basic'], fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json(route_maps_path, response.data)
def test_put_neighbor_v6(self): """Test PUT NeighborV6.""" neighbor_v6_path = self.json_path.\ format('one_neighbor_v6.json') response = self.client.put( self.neighbor_v6_uri, data=self.load_json(neighbor_v6_path), content_type=self.content_type, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) get_ids = [data['id'] for data in response.data] uri = mount_url(self.neighbor_v6_uri, get_ids, fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json(neighbor_v6_path, response.data)
def test_get_basic_list_config_bgp_by_search(self): """Test GET ListConfigBGP with kind=basic by search.""" lists_config_bgp_path = self.json_path.format('pk_1_basic.json') search = { 'start_record': 0, 'end_record': 25, 'asorting_cols': [], 'searchable_columns': [], 'extends_search': [{ 'name': 'test_1' }] } uri = mount_url(self.list_config_bgp_uri, kind=['basic'], search=search, fields=self.fields) response = self.client.get(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) self.compare_json_lists(lists_config_bgp_path, response.data['lists_config_bgp'])
def test_get_inexistent_list_config_bgp(self): """Test GET inexistent ListConfigBGP by id.""" get_ids = [1000] uri = mount_url(self.list_config_bgp_uri, get_ids) response = self.client.get(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(404, response.status_code) self.compare_values(u'ListConfigBGP id = 1000 do not exist', response.data['detail'])
def test_get_inexistent_neighbor_v4(self): """Test GET inexistent NeighborV4 by id.""" get_ids = [1000] uri = mount_url(self.neighbor_v4_uri, get_ids) response = self.client.get(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(404, response.status_code) self.compare_values(u'NeighborV4 id = 1000 do not exist', response.data['detail'])
def test_delete_inexistent_neighbors_v6(self): """Test DELETE inexistent NeighborsV6.""" delete_ids = [1000, 1001] uri = mount_url(self.neighbor_v6_uri, delete_ids) response = self.client.delete(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(404, response.status_code) self.compare_values(u'NeighborV6 id = 1000 do not exist', response.data['detail'])
def test_delete_deployed_neighbor_v6(self): """Test DELETE deployed NeighborV6.""" delete_ids = [2] uri = mount_url(self.neighbor_v6_uri, delete_ids) response = self.client.delete(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(400, response.status_code) self.compare_values(u'NeighborV6 id = 2 is deployed', response.data['detail'])
def test_delete_inexistent_peer_group(self): """Test DELETE inexistent PeerGroup.""" delete_ids = [1000] uri = mount_url(self.peer_group_uri, delete_ids) response = self.client.delete(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(404, response.status_code) self.compare_values(u'PeerGroup id = 1000 do not exist', response.data['detail'])
def test_get_inexistent_route_map_entry(self): """Test GET inexistent RouteMapEntry by id.""" get_ids = [1000] uri = mount_url(self.route_map_entry_uri, get_ids) response = self.client.get(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(404, response.status_code) self.compare_values(u'RouteMapEntry id = 1000 do not exist', response.data['detail'])
def test_delete_inexistent_route_maps(self): """Test DELETE inexistent RouteMaps.""" delete_ids = [1000, 1001] uri = mount_url(self.route_map_uri, delete_ids) response = self.client.delete(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(404, response.status_code) self.compare_values(u'RouteMap id = 1000 do not exist', response.data['detail'])
def test_get_lists_config_bgp_by_ids(self): """Test GET ListsConfigBGP without kind by ids.""" lists_config_bgp_path = self.json_path.format('pk_1;2.json') get_ids = [1, 2] uri = mount_url(self.list_config_bgp_uri, get_ids, fields=self.fields) response = self.client.get(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) self.compare_json_lists(lists_config_bgp_path, response.data['lists_config_bgp'])
def test_delete_route_map_assoc_to_route_map_entry(self): """Test DELETE RouteMap associated to RouteMapEntry.""" delete_ids = [4] uri = mount_url(self.route_map_uri, delete_ids) response = self.client.delete(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(400, response.status_code) self.compare_values( u'RouteMap id = 4 is associated with RouteMapEntries ids = [1]', response.data['detail'])
def test_delete_peer_group_assoc_with_neighbors(self): """Test DELETE PeerGroup associated with neighbors.""" delete_ids = [1] uri = mount_url(self.peer_group_uri, delete_ids) response = self.client.delete(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(400, response.status_code) self.compare_values( u'PeerGroup id = 1 is associated ' u'with NeighborsV4 id = [1] and NeighborsV6 id = [1]', response.data['detail'])
def test_get_details_neighbor_v4_by_ids(self): """Test GET NeighborV4 with kind=details by ids.""" neighbor_v4_path = self.json_path.format('pk_1_details.json') get_ids = [1] uri = mount_url(self.neighbor_v4_uri, get_ids, kind=['details'], fields=self.fields) response = self.client.get(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) self.compare_json_lists(neighbor_v4_path, response.data['neighbors'])
def test_get_details_route_map_entries_by_ids(self): """Test GET RouteMapEntries with kind=details by ids.""" route_map_entries_path = self.json_path.format('pk_1;2_details.json') get_ids = [1, 2] uri = mount_url(self.route_map_entry_uri, get_ids, kind=['details'], fields=self.fields) response = self.client.get(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) self.compare_json_lists(route_map_entries_path, response.data['route_map_entries'])
def test_delete_neighbor_v4(self): """Test DELETE NeighborV4.""" delete_ids = [1] uri = mount_url(self.neighbor_v4_uri, delete_ids) response = self.client.delete(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) response = self.client.get(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(404, response.status_code) self.compare_values(u'NeighborV4 id = 1 do not exist', response.data['detail'])
def test_delete_inexistent_neighbors_v6(self): """Test DELETE inexistent NeighborsV6.""" delete_ids = [1000, 1001] uri = mount_url(self.neighbor_v6_uri, delete_ids) response = self.client.delete( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(404, response.status_code) self.compare_values( u'NeighborV6 id = 1000 do not exist', response.data['detail'] )
def test_delete_deployed_neighbor_v6(self): """Test DELETE deployed NeighborV6.""" delete_ids = [2] uri = mount_url(self.neighbor_v6_uri, delete_ids) response = self.client.delete( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(400, response.status_code) self.compare_values( u'NeighborV6 id = 2 is deployed', response.data['detail'] )
def test_get_inexistent_peer_group(self): """Test GET inexistent PeerGroup by id.""" get_ids = [1000] uri = mount_url(self.peer_group_uri, get_ids) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(404, response.status_code) self.compare_values( u'PeerGroup id = 1000 do not exist', response.data['detail'] )
def test_get_inexistent_list_config_bgp(self): """Test GET inexistent ListConfigBGP by id.""" get_ids = [1000] uri = mount_url(self.list_config_bgp_uri, get_ids) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(404, response.status_code) self.compare_values( u'ListConfigBGP id = 1000 do not exist', response.data['detail'] )
def test_get_lists_config_bgp_by_ids(self): """Test GET ListsConfigBGP without kind by ids.""" lists_config_bgp_path = self.json_path.format('pk_1;2.json') get_ids = [1, 2] uri = mount_url(self.list_config_bgp_uri, get_ids, fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json_lists(lists_config_bgp_path, response.data['lists_config_bgp'])
def test_delete_peer_group_assoc_with_neighbors(self): """Test DELETE PeerGroup associated with neighbors.""" delete_ids = [1] uri = mount_url(self.peer_group_uri, delete_ids) response = self.client.delete( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(400, response.status_code) self.compare_values( u'PeerGroup id = 1 is associated ' u'with NeighborsV4 id = [1] and NeighborsV6 id = [1]', response.data['detail'] )
def test_get_inexistent_neighbor_v4(self): """Test GET inexistent NeighborV4 by id.""" get_ids = [1000] uri = mount_url(self.neighbor_v4_uri, get_ids) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(404, response.status_code) self.compare_values( u'NeighborV4 id = 1000 do not exist', response.data['detail'] )
def test_delete_inexistent_lists_config_bgp(self): """Test DELETE inexistent ListsConfigBGP.""" delete_ids = [1000, 1001] uri = mount_url(self.list_config_bgp_uri, delete_ids) response = self.client.delete( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(404, response.status_code) self.compare_values( u'ListConfigBGP id = 1000 do not exist', response.data['detail'] )
def test_get_inexistent_route_map_entry(self): """Test GET inexistent RouteMapEntry by id.""" get_ids = [1000] uri = mount_url(self.route_map_entry_uri, get_ids) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(404, response.status_code) self.compare_values( u'RouteMapEntry id = 1000 do not exist', response.data['detail'] )
def test_get_route_maps_by_ids(self): """Test GET RouteMaps without kind by ids.""" route_maps_path = self.json_path.format('pk_1;2.json') get_ids = [1, 2] uri = mount_url(self.route_map_uri, get_ids, fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json_lists(route_maps_path, response.data['route_maps'])
def test_delete_inexistent_route_map_entries(self): """Test DELETE inexistent RouteMapEntries.""" delete_ids = [1000, 1001] uri = mount_url(self.route_map_entry_uri, delete_ids) response = self.client.delete( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(404, response.status_code) self.compare_values( u'RouteMapEntry id = 1000 do not exist', response.data['detail'] )
def test_delete_route_map_entry_with_deployed_route_map(self): """Test DELETE RouteMapEntry with deployed RouteMap.""" delete_ids = [2] uri = mount_url(self.route_map_entry_uri, delete_ids) response = self.client.delete( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(400, response.status_code) self.compare_values( u'RouteMap id = 2 is deployed at ' u'NeighborsV4 = [1] and NeighborsV6 = []', response.data['detail'] )
def test_get_details_peer_group_by_id(self): """Test GET PeerGroup with kind=details by id.""" peer_groups_path = self.json_path.format('pk_1_details.json') get_ids = [1] uri = mount_url(self.peer_group_uri, get_ids, kind=['details'], fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json_lists(peer_groups_path, response.data['peer_groups'])
def test_delete_list_config_bgp_assoc_to_route_map_entry(self): """Test DELETE ListConfigBGP associated to RouteMapEntry.""" delete_ids = [1] uri = mount_url(self.list_config_bgp_uri, delete_ids) response = self.client.delete( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(400, response.status_code) self.compare_values( u'ListConfigBGP id = 1 is associated ' u'in RouteMapEntries = [1]', response.data['detail'] )
def test_get_details_neighbor_v4_by_ids(self): """Test GET NeighborV4 with kind=details by ids.""" neighbor_v4_path = self.json_path.format('pk_1_details.json') get_ids = [1] uri = mount_url(self.neighbor_v4_uri, get_ids, kind=['details'], fields=self.fields) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) self.compare_json_lists(neighbor_v4_path, response.data['neighbors'])
def test_put_route_map_entries(self): """Test PUT RouteMapEntries.""" route_map_entries_path = self.json_path.\ format('two_route_map_entries.json') response = self.client.put(self.route_map_entry_uri, data=self.load_json(route_map_entries_path), content_type=self.content_type, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) get_ids = [data['id'] for data in response.data] uri = mount_url(self.route_map_entry_uri, get_ids, fields=self.fields) response = self.client.get(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) self.compare_json(route_map_entries_path, response.data)
def test_put_lists_config_bgp(self): """Test PUT ListsConfigBGP.""" lists_config_bgp_path = self.json_path.\ format('two_lists_config_bgp.json') response = self.client.put(self.list_config_bgp_uri, data=self.load_json(lists_config_bgp_path), content_type=self.content_type, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) get_ids = [data['id'] for data in response.data] uri = mount_url(self.list_config_bgp_uri, get_ids, kind=['basic'], fields=self.fields) response = self.client.get(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) self.compare_json(lists_config_bgp_path, response.data)
def test_delete_neighbor_v4(self): """Test DELETE NeighborV4.""" delete_ids = [1] uri = mount_url(self.neighbor_v4_uri, delete_ids) response = self.client.delete( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(404, response.status_code) self.compare_values( u'NeighborV4 id = 1 do not exist', response.data['detail'] )
def test_delete_peer_group(self): """Test DELETE PeerGroup.""" delete_ids = [1] uri = mount_url(self.peer_group_uri, delete_ids) response = self.client.delete( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(404, response.status_code) self.compare_values( u'PeerGroup id = 1 do not exist', response.data['detail'] )
def test_delete_route_map_entry(self): """Test DELETE RouteMapEntry.""" delete_ids = [1] uri = mount_url(self.route_map_entry_uri, delete_ids) response = self.client.delete( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(200, response.status_code) response = self.client.get( uri, HTTP_AUTHORIZATION=self.authorization ) self.compare_status(404, response.status_code) self.compare_values( u'RouteMapEntry id = 1 do not exist', response.data['detail'] )
def test_get_basic_neighbor_v4_by_search(self): """Test GET NeighborV4 with kind=basic by search.""" neighbor_v4_path = self.json_path.format('pk_1_basic.json') search = { 'start_record': 0, 'end_record': 25, 'asorting_cols': [], 'searchable_columns': [], 'extends_search': [{ 'virtual_interface': 'test_vi' }] } uri = mount_url(self.neighbor_v4_uri, kind=['basic'], search=search, fields=self.fields) response = self.client.get(uri, HTTP_AUTHORIZATION=self.authorization) self.compare_status(200, response.status_code) self.compare_json_lists(neighbor_v4_path, response.data['neighbors'])