#NEWLINE# def test_router_update_on_external_port( self ) : #NEWLINE# #INDENT# with self . router ( ) as r : #NEWLINE# #INDENT# with self . subnet ( cidr = '10.0.1.0/24' ) as s : #NEWLINE# #INDENT# self . _set_net_external ( s [ 'subnet' ] [ 'network_id' ] ) #NEWLINE# self . _add_external_gateway_to_router ( r [ 'router' ] [ 'id' ] , body [ 'subnet' ] [ 'network_id' ] ) #NEWLINE# body = self . _show ( 'routers' , r [ 'router' ] [ 'id' ] ) #NEWLINE# net_id = body [ 'router' ] [ 'external_gateway_info' ] [ 'network_id' ] #NEWLINE# self . assertEqual ( net_id , s [ 'subnet' ] [ 'network_id' ] ) #NEWLINE# port_res = self . _list_ports ( 'json' , 200 , s [ 'subnet' ] [ 'network_id' ] , tenant_id = r [ 'router' ] [ 'tenant_id' ] , device_owner = constants . DEVICE_OWNER_ROUTER_GW ) #NEWLINE# port_list = self . deserialize ( 'json' , port_res ) #NEWLINE# self . assertEqual ( 1 , len ( port_list [ 'ports' ] ) ) #NEWLINE# routes = [ { #NEWLINE# #INDENT# 'destination' : '135.207.0.0/16' , #NEWLINE# 'nexthop' : '10.0.1.3' , #NEWLINE# #UNINDENT# } ] #NEWLINE# body = self . _update ( 'routers' , r [ 'router' ] [ 'id' ] , { #NEWLINE# #INDENT# 'router' : { #NEWLINE# #INDENT# 'routes' : routes , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# body = self . _show ( 'routers' , r [ 'router' ] [ 'id' ] ) #NEWLINE# self . assertEqual ( routes , body [ 'router' ] [ 'routes' ] ) #NEWLINE# self . _remove_external_gateway_from_router ( r [ 'router' ] [ 'id' ] , s [ 'subnet' ] [ 'network_id' ] ) #NEWLINE# body = self . _show ( 'routers' , r [ 'router' ] [ 'id' ] ) #NEWLINE# gw_info = body [ 'router' ] [ 'external_gateway_info' ] #NEWLINE# self . assertIsNone ( gw_info )