Update the voltha code to make use of the interface option and add
a new voltha swarm file.
Change-Id: Icf2bd5a35aea3a8aa55de58acb56bfa6f4b34e0d
diff --git a/voltha/main.py b/voltha/main.py
index 787eb36..9eb12d4 100755
--- a/voltha/main.py
+++ b/voltha/main.py
@@ -52,13 +52,11 @@
defs = dict(
config=os.environ.get('CONFIG', './voltha.yml'),
consul=os.environ.get('CONSUL', 'localhost:8500'),
- external_host_address=os.environ.get('EXTERNAL_HOST_ADDRESS',
- get_my_primary_local_ipv4()),
+ external_host_address=os.environ.get('EXTERNAL_HOST_ADDRESS', None),
fluentd=os.environ.get('FLUENTD', None),
grpc_port=os.environ.get('GRPC_PORT', 50055),
instance_id=os.environ.get('INSTANCE_ID', os.environ.get('HOSTNAME', '1')),
- internal_host_address=os.environ.get('INTERNAL_HOST_ADDRESS',
- get_my_primary_local_ipv4()),
+ internal_host_address=os.environ.get('INTERNAL_HOST_ADDRESS', None),
interface=os.environ.get('INTERFACE', get_my_primary_interface()),
rest_port=os.environ.get('REST_PORT', 8880),
kafka=os.environ.get('KAFKA', 'localhost:9092'),
@@ -126,8 +124,7 @@
default=defs['instance_id'],
help=_help)
- # TODO placeholder, not used yet
- _help = 'ETH interface to send (default: %s)' % defs['interface']
+ _help = 'ETH interface to recieve (default: %s)' % defs['interface']
parser.add_argument('-I', '--interface',
dest='interface',
action='store',
@@ -207,6 +204,14 @@
if args.instance_id_is_container_name:
args.instance_id = get_my_containers_name()
+ m_ip = get_my_primary_local_ipv4(args.interface)
+ if not m_ip:
+ m_ip = get_my_primary_local_ipv4()
+ if not args.external_host_address:
+ args.external_host_address = m_ip
+ if not args.internal_host_address:
+ args.internal_host_address = m_ip
+
return args
@@ -284,7 +289,9 @@
@inlineCallbacks
def startup_components(self):
try:
- self.log.info('starting-internal-components')
+ self.log.info('starting-internal-components',
+ internal_host=self.args.internal_host_address,
+ external_host=self.args.external_host_address)
registry.register('main', self)