mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-20 14:03:36 +03:00
Add qinq commands for src/vnm_mad/remotes/ovswitch/OpenvSwitch.rb
This commit is contained in:
parent
23e7828945
commit
49c43741f2
@ -70,8 +70,12 @@ class OpenvSwitchVLAN < VNMMAD::VNMDriver
|
||||
|
||||
# Apply VLAN
|
||||
if !@nic[:vlan_id].nil?
|
||||
tag_vlan
|
||||
tag_trunk_vlans
|
||||
if @nic[:qinq]
|
||||
tag_qinq
|
||||
else
|
||||
tag_vlan
|
||||
tag_trunk_vlans
|
||||
end
|
||||
end
|
||||
|
||||
# Delete any existing flows on port
|
||||
@ -159,6 +163,10 @@ class OpenvSwitchVLAN < VNMMAD::VNMDriver
|
||||
@bridges[@nic[:bridge]].delete(@nic[:vlan_dev])
|
||||
end
|
||||
|
||||
if @nic[:qinq].nil?
|
||||
set_vlan_limit("1")
|
||||
end
|
||||
|
||||
delete_bridge
|
||||
end
|
||||
|
||||
@ -195,6 +203,15 @@ class OpenvSwitchVLAN < VNMMAD::VNMDriver
|
||||
end
|
||||
end
|
||||
|
||||
def tag_qinq
|
||||
set_vlan_limit("2")
|
||||
cmd = "#{command(:ovs_vsctl)} set Port #{@nic[:tap]} vlan_mode=dot1q-tunnel "
|
||||
cmd << "tag=#{vlan} "
|
||||
cmd << "cvlans=@nic[:cvlans]"
|
||||
|
||||
run cmd
|
||||
end
|
||||
|
||||
|
||||
# Following IP-spoofing rules may be created:
|
||||
# (if ARP Cache Poisoning) in_port=<PORT>,table=20,arp,arp_spa=<IP>,priority=50000,actions=NORMAL
|
||||
@ -376,9 +393,8 @@ private
|
||||
end
|
||||
|
||||
def get_vlan_limit
|
||||
cmd = "#{ovs_vsctl_cmd} get Open_vSwitch . other_config:vlan-limit"
|
||||
|
||||
run cmd
|
||||
vlan_limit =`#{command(:ovs_vsctl)} get Open_vSwitch . other_config:vlan-limit`
|
||||
vlan_limit
|
||||
end
|
||||
|
||||
# Create a VLAN device.
|
||||
|
Loading…
x
Reference in New Issue
Block a user