Fix the bug while fetching interface mapping dict

Change-Id: Ib047c001aa8e757a1cdc660ed541725c6a0c9fc0
This commit is contained in:
Yichen Wang 2015-09-09 18:22:41 -07:00
parent b38d42b7bf
commit 0ccb558524

@ -377,14 +377,16 @@ class Network(object):
hostname = agent['host']
if 'Linux bridge' in agent_type:
agent_detail = self.neutron_client.show_agent(agent['id'])['agent']
ifname = agent_detail['configurations']['interface_mappings']['physnet1']
internal_iface_dict[hostname] = ifname
if 'physnet1' in agent_detail['configurations']['interface_mappings']:
ifname = agent_detail['configurations']['interface_mappings']['physnet1']
internal_iface_dict[hostname] = ifname
elif 'Open vSwitch' in agent_type:
network_type = self.vm_int_net[0]['provider:network_type']
agent_detail = self.neutron_client.show_agent(agent['id'])['agent']
if network_type == "vlan":
brname = agent_detail['configurations']['bridge_mappings']['physnet1']
internal_iface_dict[hostname] = brname
if 'physnet1' in agent_detail['configurations']['bridge_mappings']:
brname = agent_detail['configurations']['bridge_mappings']['physnet1']
internal_iface_dict[hostname] = brname
elif network_type == "vxlan" or network_type == 'gre':
ipaddr = agent_detail['configurations']['tunneling_ip']
internal_iface_dict[hostname] = ipaddr