From 4ec6651a8ffd6fb07875b16a9f86ac0bfd816630 Mon Sep 17 00:00:00 2001 From: "t.moriyama" Date: Sun, 21 Jul 2013 04:53:09 +0900 Subject: [PATCH] add routing informations for tunneling remote_ip to OVSAgent --- linkpair/collect/agent/ovs_agent.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/linkpair/collect/agent/ovs_agent.py b/linkpair/collect/agent/ovs_agent.py index f7fc1eb..f16f5c3 100755 --- a/linkpair/collect/agent/ovs_agent.py +++ b/linkpair/collect/agent/ovs_agent.py @@ -75,6 +75,21 @@ class OVSAgent(BaseAgent): opt_value = opt_value.replace("\""," ") opt_value = opt_value.strip() port_meta[opt_name] = opt_value + if opt_name == "remote_ip": + res_iproute = self._runner.exec_cmd("ip route get " + opt_value) + for i in range(0, len(res_iproute)): + remote_route = res_iproute[i].strip() + if self._u.d_push(re.search(r'via (\S+) dev (\S+) src (\S+)', remote_route)) is not None: + match = self._u.d_pop() + port_meta["remote_routing_if_ipaddr"] = match.group(1).strip() + port_meta["remote_routing_if_dev"] = match.group(2).strip() + port_meta["remote_routing_src_ipaddr"] = match.group(3).strip() + elif self._u.d_push(re.search(r'cache mtu (\d+) advmss (\d+) hoplimit (\d+)', remote_route)) is not None: + match = self._u.d_pop() + port_meta["remote_peer_mtu"] = match.group(1).strip() + port_meta["remote_peer_mss"] = match.group(2).strip() + port_meta["remote_peer_hoplimit"] = match.group(3).strip() + elif self._u.d_push(re.search(r'Port "*', port_spec)) is not None: break -- 2.11.0