def test_restd_bgp_neighbors_put_bgp_neighbors(setup, sanity_check, topology, step): step("\n#####################################################\n") step("# Testing PUT for BGP_Neighbors #") step("\n#####################################################\n") aux = copy.deepcopy(_DATA_BGP_NEIGHBORS_COPY) aux['configuration']['description'] = 'BGP_Neighbors' status_code, response_data = execute_request( path_bgp_neighbors_id, "PUT", json.dumps(aux), SWITCH_IP, False, xtra_header=cookie_header) assert status_code == http.client.OK status_code, response_data = execute_request( path_bgp_neighbors_id, "GET", None, SWITCH_IP, False, xtra_header=cookie_header) assert status_code == http.client.OK d = get_json(response_data) d['configuration'].pop('capability', None) d = d['configuration'] d = sorted(d.items(), key=itemgetter(0)) aux = aux['configuration'] aux = sorted(aux.items(), key=itemgetter(0)) assert d == aux
def test_restd_bgp_neighbors_post_bgp_neighbors(setup, sanity_check, topology, step): step("\n#####################################################\n") step("# Testing POST for BGP_Neighbors #") step("\n#####################################################\n") step('\nPOST BGP router with the asn: {}'.format( str(_DATA['configuration']['asn']))) status_code, response_data = execute_request( path_bgp, "POST", json.dumps(_DATA), SWITCH_IP, False, xtra_header=cookie_header) assert status_code == http.client.CREATED step('\nPOST BGP neighbors with the ip: {}'.format( str(_DATA_BGP_NEIGHBORS['configuration']['ip_or_group_name']))) status_code, response_data = execute_request( path_bgp_neighbors, "POST", json.dumps(_DATA_BGP_NEIGHBORS), SWITCH_IP, False, xtra_header=cookie_header) assert status_code == http.client.CREATED status_code, response_data = execute_request( path_bgp_neighbors_id, "GET", None, SWITCH_IP, False, xtra_header=cookie_header) assert status_code == http.client.OK d = get_json(response_data) d = d['configuration'] d = sorted(d.items(), key=itemgetter(0)) aux = _DATA_BGP_NEIGHBORS_COPY['configuration'] aux = sorted(aux.items(), key=itemgetter(0)) assert d == aux
def test_restd_ct_bgp_routers_post_bgp_routers(setup, sanity_check, topology, step): step("\n#####################################################\n") step("# Testing POST for BGP_Routers #") step("\n#####################################################\n") status_code, response_data = execute_request(path_bgp, "POST", json.dumps(_DATA), SWITCH_IP, False, xtra_header=cookie_header) assert status_code == http.client.CREATED status_code, response_data = execute_request(path_id, "GET", None, SWITCH_IP, False, xtra_header=cookie_header) assert status_code == http.client.OK d = get_json(response_data) d = d['configuration'] d = sorted(d.items(), key=itemgetter(0)) aux = _DATA_COPY['configuration'] aux = sorted(aux.items(), key=itemgetter(0)) assert d == aux
def test_restd_ct_bgp_routers_put_bgp_routers(setup, sanity_check, topology, step): step("\n#####################################################\n") step("# Testing PUT for BGP_Routers #") step("\n#####################################################\n") aux = copy.deepcopy(_DATA_COPY) aux['configuration']['networks'] = ["10.10.1.0/24"] status_code, response_data = execute_request(path_id, "PUT", json.dumps(aux), SWITCH_IP, False, xtra_header=cookie_header) assert status_code == http.client.OK status_code, response_data = execute_request(path_id, "GET", None, SWITCH_IP, False, xtra_header=cookie_header) status_code == http.client.OK content = response_data d = get_json(content) d = d['configuration'] d = sorted(d.items(), key=itemgetter(0)) aux = aux['configuration'] aux = sorted(aux.items(), key=itemgetter(0)) assert d == aux
def test_restd_ct_bgp_routers_get_bgp_routers(setup, sanity_check, topology, step): step("\n#####################################################\n") step("# Testing GET for BGP_Routers #") step("\n#####################################################\n") step('GET for BGP router with asn: {}'.format( str(_DATA['configuration']['asn']))) status_code, response_data = execute_request(path_id, "GET", None, SWITCH_IP, False, xtra_header=cookie_header) assert status_code == http.client.OK d = get_json(response_data) d = d['configuration'] d = sorted(d.items(), key=itemgetter(0)) aux = _DATA_COPY['configuration'] aux = sorted(aux.items(), key=itemgetter(0)) assert d == aux