/usr/local/bin/ovs-vsctl --may-exist add-br %s -- set Bridge %s datapath_type=netdev \
-- br-set-external-id %s bridge-id %s -- set bridge %s fail-mode=standalone"
br-set-external-id 增加桥口属性;
OpenvSwitch 在无法连接到控制器时候(fail mode)可以选择两种fail状态,一种是standalone,一种是secure状态。如果是配置了standalone(或者未设置fail mode)mode,在三次探测控制器连接不成功后,此时ovs-vswitchd将会接管转发逻辑(后台仍然尝试连接到控制器,一旦连接则退出fail状态),OpenvSwitch将作为一个正常的mac 学习的二层交换机。如果是配置了secure mode,则ovs-vswitchd将不会自动配置新的转发流表,OpenvSwitch将按照原先有的流表转发。可以通过下面命令进行管理。
/usr/local/bin/ovs-vsctl set-controller %s tcp:%s:%s
设置/清除网桥的openflow协议版本
/usr/local/bin/ovs-vsctl set Bridge %s protocols=OpenFlow13
/usr/local/bin/ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x%x
other_config:pmd-cpu-mask=0x60 60是配置pmd的个数和与核的关系(这里的意思是核5和核6各跑一个pmd线程),绑定的核最好是隔离出来的核,pmd数量不是越多越好,我时,2个pmd效果比较好
dpdk:
pci绑定:
/usr/local/dpdk-17.02/usertools/dpdk-devbind.py -b igb_uio vswitch->ifName[i].pci
设置接口type:dpdk
/usr/local/bin/ovs-vsctl add-port %s %s -- set Interface %s type=dpdk options:dpdk-devargs=%s vswitch->ifName[i].pci
/* 检测test ovs status */
/usr/local/bin/ovs-ofctl -O OpenFlow13 show vswitch1
/*检测 controller status */
/usr/local/bin/ovs-vsctl show | grep %s -A 2 | grep is_connected | wc -l
设置接口vlan属性
/usr/local/bin/ovs-vsctl set port %s vlan_mode=trunk
移除 hidden flow ovs-vsctl set bridge br0 other-config:disable-in-band=true
修改dpid:ovs-vsctl set bridge 交换机名 other_config:datapath-id=新DPID
/usr/local/bin/ovs-vsctl set bridge %s other_config:datapath-id=%s
查看dpid
[root@localhost /]# /usr/local/bin/ovs-ofctl -O OpenFlow13 show vswitch2 | grep dpid
OFPT_FEATURES_REPLY (OF1.3) (xid=0x2): dpid:000000900b3aa9ba
[root@localhost /]#