~openstack-charmers-next/charms/xenial/rabbitmq-server/trunk

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/network/ip.py

  • Committer: James Page
  • Date: 2016-04-01 08:25:33 UTC
  • Revision ID: james.page@ubuntu.com-20160401082533-aumnrefs36w8k24f
Add Juju Network Space support

Juju 2.0 provides support for network spaces, allowing
charm authors to support direct binding of relations and
extra-bindings onto underlying network spaces.

Resync charm-helpers to pickup support in network-get
hookenv support, use binding of amqp relation if running
on Juju >= 2.0 and access-network is not configured.

Add new section to README and generally tidy as well as
it lacks any really useful content and was confusing.

Change-Id: I196628463f3da8f8db76cd87045a37ab715a09c8

Show diffs side-by-side

added added

removed removed

Lines of Context:
191
191
get_netmask_for_address = partial(_get_for_address, key='netmask')
192
192
 
193
193
 
 
194
def resolve_network_cidr(ip_address):
 
195
    '''
 
196
    Resolves the full address cidr of an ip_address based on
 
197
    configured network interfaces
 
198
    '''
 
199
    netmask = get_netmask_for_address(ip_address)
 
200
    return str(netaddr.IPNetwork("%s/%s" % (ip_address, netmask)).cidr)
 
201
 
 
202
 
194
203
def format_ipv6_addr(address):
195
204
    """If address is IPv6, wrap it in '[]' otherwise return None.
196
205