Skip to content

Commit

Permalink
Merge "Allocate mac address for service instance ports"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jun 2, 2015
2 parents f2ae64c + 8f29f76 commit af7ce2b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/config/svc-monitor/svc_monitor/instance_manager.py
Expand Up @@ -49,6 +49,10 @@ def delete_service(self, vm):
def check_service(self, si):
pass

def mac_alloc(self, uuid):
return '02:%s:%s:%s:%s:%s' % (uuid[0:2], uuid[2:4],
uuid[4:6], uuid[6:8], uuid[9:11])

def _get_default_security_group(self, vn):
sg_fq_name = vn.fq_name[:-1] + ['default']
for sg in SecurityGroupSM.values():
Expand Down Expand Up @@ -258,6 +262,7 @@ def validate_network_config(self, st, si):
nic['static-route-enable'] = st_if.get('static_route_enable')
nic['static-routes'] = si_if.get('static_routes')
nic['user-visible'] = user_visible
nic['mac-address'] = self.mac_alloc(vn_id)
si.vn_info.insert(index, nic)

if config_complete:
Expand Down Expand Up @@ -396,6 +401,8 @@ def _create_svc_vm_port(self, nic, instance_name, si, st,
vmi_updated = True

if vmi_create:
mac_addrs_obj = MacAddressesType([nic['mac-address']])
vmi_obj.set_virtual_machine_interface_mac_addresses(mac_addrs_obj)
try:
self._vnc_lib.virtual_machine_interface_create(vmi_obj)
except RefsExistError:
Expand Down

0 comments on commit af7ce2b

Please sign in to comment.