zoukankan      html  css  js  c++  java
  • ovs vtep 源码Tunnel_Ip

    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]# 
  • 相关阅读:
    EF Core 打印日志
    生成各种开源挂件的网址
    .NET Core 原生 Aop,不依赖任何第三方
    .NET Core + Castle.DynamicProxy 拦截
    EF Core 审计日志
    Gitee 接口大全
    VS 批量新增文件头
    Linq 完全指南
    swagger转word
    大型网站架构
  • 原文地址:https://www.cnblogs.com/dream397/p/13275142.html
Copyright © 2011-2022 走看看