Add docker network_gateway attribute
We previously had it in network_ip attribute when that value should have been the container ip. Add a new value called network_gateway giving this information to the user. Change-Id: I8ebfc576f4bbc470aa2d405e8b063932017904cc Closes-Bug: 1296745
This commit is contained in:
parent
6c2ed29665
commit
13afa377ff
@ -130,6 +130,7 @@ class DockerContainer(resource.Resource):
|
|||||||
'info': _('Container info'),
|
'info': _('Container info'),
|
||||||
'network_info': _('Container network info'),
|
'network_info': _('Container network info'),
|
||||||
'network_ip': _('Container ip address'),
|
'network_ip': _('Container ip address'),
|
||||||
|
'network_gateway': _('Container ip gateway'),
|
||||||
'network_tcp_ports': _('Container TCP ports'),
|
'network_tcp_ports': _('Container TCP ports'),
|
||||||
'network_udp_ports': _('Container UDP ports'),
|
'network_udp_ports': _('Container UDP ports'),
|
||||||
'logs': _('Container logs'),
|
'logs': _('Container logs'),
|
||||||
@ -183,6 +184,10 @@ class DockerContainer(resource.Resource):
|
|||||||
client = self.get_client()
|
client = self.get_client()
|
||||||
networkinfo = self._container_networkinfo(client, self.resource_id)
|
networkinfo = self._container_networkinfo(client, self.resource_id)
|
||||||
return networkinfo['IPAddress']
|
return networkinfo['IPAddress']
|
||||||
|
if name == 'network_gateway':
|
||||||
|
client = self.get_client()
|
||||||
|
networkinfo = self._container_networkinfo(client, self.resource_id)
|
||||||
|
return networkinfo['Gateway']
|
||||||
if name == 'network_tcp_ports':
|
if name == 'network_tcp_ports':
|
||||||
client = self.get_client()
|
client = self.get_client()
|
||||||
networkinfo = self._container_networkinfo(client, self.resource_id)
|
networkinfo = self._container_networkinfo(client, self.resource_id)
|
||||||
|
@ -81,6 +81,7 @@ class DockerContainerTest(HeatTestCase):
|
|||||||
def test_resource_attributes(self):
|
def test_resource_attributes(self):
|
||||||
container = self.create_container('Blog')
|
container = self.create_container('Blog')
|
||||||
# Test network info attributes
|
# Test network info attributes
|
||||||
|
self.assertEqual('172.17.42.1', container.FnGetAtt('network_gateway'))
|
||||||
self.assertEqual('172.17.0.3', container.FnGetAtt('network_ip'))
|
self.assertEqual('172.17.0.3', container.FnGetAtt('network_ip'))
|
||||||
self.assertEqual('1080', container.FnGetAtt('network_tcp_ports'))
|
self.assertEqual('1080', container.FnGetAtt('network_tcp_ports'))
|
||||||
self.assertEqual('', container.FnGetAtt('network_udp_ports'))
|
self.assertEqual('', container.FnGetAtt('network_udp_ports'))
|
||||||
|
Loading…
Reference in New Issue
Block a user