OSDN Git Service

add routing informations for tunneling remote_ip to OVSAgent
authort.moriyama <t.moriyama@users.sourceforge.jp>
Sat, 20 Jul 2013 19:53:09 +0000 (04:53 +0900)
committert.moriyama <t.moriyama@users.sourceforge.jp>
Sat, 20 Jul 2013 19:53:09 +0000 (04:53 +0900)
linkpair/collect/agent/ovs_agent.py

index f7fc1eb..f16f5c3 100755 (executable)
@@ -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