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]# 
  • 相关阅读:
    test
    ws318 配置
    电影地址:
    白岩松给青少年的7个忠告,值得好好阅读~
    干部带队伍的四个知道,一个跟上
    CDOJ 1259 昊昊爱运动 II bitset+线段树
    codeforces 508D . Tanya and Password 欧拉通路
    poj 1041 John's trip 欧拉回路
    poj 1651 Multiplication Puzzle 区间dp
    poj 2955 Brackets 区间dp
  • 原文地址:https://www.cnblogs.com/dream397/p/13275142.html
Copyright © 2011-2022 走看看