Add gateway in network_info and share network API

Get gateway information from network plugin and put it into network_info.
It is required by EMC Unity storage to create a interface.

APIImpact
DocImpact

Change-Id: I8614b8686af7fa5764b49e8e3cb4a4855dc3a5f4
Implements: blueprint add-gateway-info
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index e2b98a3..7a7ee6f 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -34,7 +34,7 @@
                help="The minimum api microversion is configured to be the "
                     "value of the minimum microversion supported by Manila."),
     cfg.StrOpt("max_api_microversion",
-               default="2.17",
+               default="2.18",
                help="The maximum api microversion is configured to be the "
                     "value of the latest microversion supported by Manila."),
     cfg.StrOpt("region",
diff --git a/manila_tempest_tests/services/share/v2/json/shares_client.py b/manila_tempest_tests/services/share/v2/json/shares_client.py
old mode 100644
new mode 100755
index ab33002..3995161
--- a/manila_tempest_tests/services/share/v2/json/shares_client.py
+++ b/manila_tempest_tests/services/share/v2/json/shares_client.py
@@ -1210,3 +1210,24 @@
                                version=version)
         self.expected_success(202, resp.status)
         return self._parse_resp(body)
+
+    def list_share_networks(self, detailed=False, params=None,
+                            version=LATEST_MICROVERSION):
+        """Get list of share networks w/o filters."""
+        uri = 'share-networks/detail' if detailed else 'share-networks'
+        uri += '?%s' % urlparse.urlencode(params) if params else ''
+        resp, body = self.get(uri, version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+    def list_share_networks_with_detail(self, params=None,
+                                        version=LATEST_MICROVERSION):
+        """Get detailed list of share networks w/o filters."""
+        return self.list_share_networks(
+            detailed=True, params=params, version=version)
+
+    def get_share_network(self, share_network_id, version=LATEST_MICROVERSION):
+        resp, body = self.get("share-networks/%s" % share_network_id,
+                              version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
diff --git a/manila_tempest_tests/tests/api/test_share_networks.py b/manila_tempest_tests/tests/api/test_share_networks.py
old mode 100644
new mode 100755
index ef8bb01..b9d2d8c
--- a/manila_tempest_tests/tests/api/test_share_networks.py
+++ b/manila_tempest_tests/tests/api/test_share_networks.py
@@ -19,6 +19,7 @@
 import testtools
 
 from manila_tempest_tests.tests.api import base
+from manila_tempest_tests import utils
 
 CONF = config.CONF
 
@@ -37,7 +38,7 @@
 
     @test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
     def test_list_share_networks_with_detail(self):
-        listed = self.shares_client.list_share_networks_with_detail()
+        listed = self.shares_v2_client.list_share_networks_with_detail()
         any(self.sn_with_ldap_ss["id"] in sn["id"] for sn in listed)
 
         # verify keys
@@ -47,6 +48,11 @@
             "neutron_net_id", "neutron_subnet_id",
             "created_at", "updated_at", "segmentation_id",
         ]
+
+        # In v2.18 and beyond, we expect gateway.
+        if utils.is_microversion_supported('2.18'):
+            keys.append('gateway')
+
         [self.assertIn(key, sn.keys()) for sn in listed for key in keys]
 
     @test.attr(type=[base.TAG_POSITIVE, base.TAG_API])