Minor modifications to include vim_id of interfaces when creating a vm 92/5492/2
authormontesmoreno <pablo.montesmoreno@telefonica.com>
Mon, 2 Oct 2017 16:19:05 +0000 (18:19 +0200)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Mon, 2 Oct 2017 16:27:23 +0000 (18:27 +0200)
Change-Id: Ie44f998d2c37c26d78cec9b93d9fb634221ffcb5
Signed-off-by: montesmoreno <pablo.montesmoreno@telefonica.com>
osm_ro/vimconn_aws.py

index 5ee75e4..3ccef44 100644 (file)
@@ -651,9 +651,7 @@ class vimconnector(vimconn.vimconnector):
                     security_groups=self.security_groups,
                     user_data=userdata
                 )
-                instance = reservation.instances[0]
             else:
-                net_list = [net_list[0]]
                 for index, subnet in enumerate(net_list):
                     net_intr = boto.ec2.networkinterface.NetworkInterfaceSpecification(subnet_id=subnet.get('net_id'),
                                                                                        groups=None,
@@ -672,7 +670,6 @@ class vimconnector(vimconn.vimconnector):
                             network_interfaces=boto.ec2.networkinterface.NetworkInterfaceCollection(net_intr),
                             user_data=userdata
                         )
-                        instance = reservation.instances[0]
                     else:
                         while True:
                             try:
@@ -682,6 +679,9 @@ class vimconnector(vimconn.vimconnector):
                                 break
                             except:
                                 time.sleep(10)
+                    net_list[index]['vim_id'] = reservation.instances[0].interfaces[index].id
+
+            instance = reservation.instances[0]
             return instance.id
         except Exception as e:
             self.format_vimconn_exception(e)