Skip to content

Commit

Permalink
Merge "In ContrailVRouterApi, do a connect to the Agent only when the…
Browse files Browse the repository at this point in the history
… add port / delete port request comes from nova_contrail_vif. For other requests, do not invoke connect. In case we do a connect and do not send complete vif list, Agent removes them upon audit. Also, set port_type to NameSpacePort, if it isnt specified." into R2.0
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Dec 16, 2014
2 parents 2f82e4a + c9e0cbe commit b926380
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class ContrailVRouterApi(object):

def __init__(self, server_port=9090):
def __init__(self, server_port=9090, doconnect=False):
"""
local variables:
_client: current transport connection
Expand All @@ -18,6 +18,7 @@ def __init__(self, server_port=9090):
self._server_port = server_port
self._client = None
self._ports = {}
self._connect = doconnect

def _rpc_client_instance(self):
""" Return an RPC client connection """
Expand All @@ -32,7 +33,7 @@ def _rpc_client_instance(self):
return None
protocol = TBinaryProtocol.TBinaryProtocol(transport)
client = InstanceService.Client(protocol)
if client:
if client and self._connect:
client.Connect()
return client

Expand All @@ -59,7 +60,8 @@ def connect(self):
self._client = self._rpc_client_instance()
if self._client is None:
return False
return True
if self._connect:
return True

return self._client.Connect()

Expand Down Expand Up @@ -106,7 +108,7 @@ def add_port(self, vm_uuid_str, vif_uuid_str, interface_name, mac_address,
data.port_type = \
ttypes.PortTypes._NAMES_TO_VALUES[kwargs['port_type']]
else:
data.port_type = ttypes.PortTypes.NovaVMPort
data.port_type = ttypes.PortTypes.NameSpacePort
if 'ip6_address' in kwargs:
data.ip6_address = kwargs['ip6_address']

Expand Down

0 comments on commit b926380

Please sign in to comment.