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]# 
  • 相关阅读:
    Linux中增加组和用户
    Storm重启topology,失败
    ES读写数据的工作原理
    Hive优化
    Flink提交流程和架构
    Flink中的Time与Window
    linux 中文件夹的文件按照时间倒序或者升序排列
    ElasticSearch之配置文件详解
    redis中的设置bind绑定ip不是设置白名单
    YARN调度架构中的AppMaster
  • 原文地址:https://www.cnblogs.com/dream397/p/13275142.html
Copyright © 2011-2022 走看看