Adds coverage for AWS EIP resource in scenario tests

Change-Id: Ie37fd388ba3d6c7bc5ec03609d7d27c84ab474cc
Closes-Bug: #1269551
diff --git a/scenario/templates/test_server_cfn_init.yaml b/scenario/templates/test_server_cfn_init.yaml
index ffb8e9b..9f94717 100644
--- a/scenario/templates/test_server_cfn_init.yaml
+++ b/scenario/templates/test_server_cfn_init.yaml
@@ -28,10 +28,16 @@
     Properties:
       UserName: {Ref: CfnUser}
 
-  IPAddress:
+  ElasticIp:
     Type: AWS::EC2::EIP
     Properties:
-      InstanceId: {Ref: SmokeServer}
+      Domain: vpc
+
+  SmokeServerElasticIp:
+    Type: AWS::EC2::EIPAssociation
+    Properties:
+       EIP: {Ref: ElasticIp}
+       InstanceId: {Ref: SmokeServer}
 
   SmokeServer:
     Type: AWS::EC2::Instance
@@ -81,7 +87,11 @@
     Description: Contents of /tmp/smoke-status on SmokeServer
     Value:
       Fn::GetAtt: [WaitCondition, Data]
-  SmokeServerIp:
-    Description: IP address of server
+  ElasticIp_Id:
+    Description: Elastic ip allocation id
     Value:
-      Ref: IPAddress
+      Fn::GetAtt: [ElasticIp, AllocationId]
+  SmokeServerElasticIp:
+    Description: Elastic ip address of server
+    Value:
+      Ref: ElasticIp
diff --git a/scenario/test_server_cfn_init.py b/scenario/test_server_cfn_init.py
index b5b1e67..267b44b 100644
--- a/scenario/test_server_cfn_init.py
+++ b/scenario/test_server_cfn_init.py
@@ -27,7 +27,7 @@
     def check_stack(self, sid):
         # Check status of all resources
         for res in ('WaitHandle', 'SmokeSecurityGroup', 'SmokeKeys',
-                    'CfnUser', 'SmokeServer', 'IPAddress'):
+                    'CfnUser', 'SmokeServer', 'SmokeServerElasticIp'):
             self._wait_for_resource_status(
                 sid, res, 'CREATE_COMPLETE')
 
@@ -59,7 +59,22 @@
             self._stack_output(stack, 'WaitConditionStatus'))
         self.assertEqual('smoke test complete', wait_status['smoke_status'])
 
-        server_ip = self._stack_output(stack, 'SmokeServerIp')
+        # Check EIP attributes.
+        server_floatingip_id = self._stack_output(stack,
+                                                  'ElasticIp_Id')
+        self.assertIsNotNone(server_floatingip_id)
+
+        # Fetch EIP details.
+        net_show = self.network_client.show_floatingip(
+            floatingip=server_floatingip_id)
+        floating_ip = net_show['floatingip']['floating_ip_address']
+        port_id = net_show['floatingip']['port_id']
+
+        # Ensure that EIP was assigned to server.
+        port_show = self.network_client.show_port(port=port_id)
+        self.assertEqual(server.id, port_show['port']['device_id'])
+        server_ip = self._stack_output(stack, 'SmokeServerElasticIp')
+        self.assertEqual(server_ip, floating_ip)
 
         # Check that created server is reachable
         if not self._ping_ip_address(server_ip):