首页 > 其他 > 详细

ovs vtep 源码Tunnel_Ip

时间:2020-07-09 19:15:27      阅读:69      评论:0      收藏:0      [点我收藏+]

 

 

Tunnel_Ip

 

def setup():
    br_list = ovs_vsctl("list-br").split()
    if (ps_name not in br_list):
        ovs.util.ovs_fatal(0, "couldn‘t find OVS bridge %s" % ps_name, vlog)

    global ps_type
    ps_type = ovs_vsctl("get Bridge %s datapath_type" % ps_name).strip(")

    call_prog("vtep-ctl", ["set", "physical_switch", ps_name,
                           description="OVS VTEP Emulator"])

    tunnel_ips = vtep_ctl("get physical_switch %s tunnel_ips"
                          % ps_name).strip([]").split(", ")
    if len(tunnel_ips) != 1 or not tunnel_ips[0]:
        ovs.util.ovs_fatal(0, "exactly one ‘tunnel_ips‘ should be set", vlog)

    global Tunnel_Ip
    Tunnel_Ip = tunnel_ips[0]

 

[root@kunpeng82 scripts]# vtep-ctl get physical_switch br0 tunnel_ips
["192.168.16.81"]
[root@kunpeng82 scripts]# 

 

class Logical_Switch(object):
  

    def setup_ls(self):

        if ps_type:
            ovs_vsctl("--may-exist add-br %s -- set Bridge %s datapath_type=%s"
                      % (self.short_name, self.short_name, ps_type))
        else:
            ovs_vsctl("--may-exist add-br %s" % self.short_name)

        ovs_vsctl("br-set-external-id %s vtep_logical_switch true"
                  % self.short_name)
        ovs_vsctl("br-set-external-id %s logical_switch_name %s"
                  % (self.short_name, self.name))

        vtep_ctl("clear-local-macs %s" % self.name)
        vtep_ctl("add-mcast-local %s unknown-dst %s" % (self.name, Tunnel_Ip))
         每个loggis swtich 的多播
        ovs_ofctl("del-flows %s" % self.short_name)
        ovs_ofctl("add-flow %s priority=0,action=drop" % self.short_name)
[root@kunpeng82 scripts]# vtep-ctl list-local-macs ls2
ucast-mac-local

mcast-mac-local
  unknown-dst -> vxlan_over_ipv4/192.168.16.81

[root@kunpeng82 scripts]# vtep-ctl list-local-macs ls0
ucast-mac-local

mcast-mac-local
  unknown-dst -> vxlan_over_ipv4/192.168.16.81

[root@kunpeng82 scripts]# 

 

ovs vtep 源码Tunnel_Ip

原文:https://www.cnblogs.com/dream397/p/13275142.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!