Skip to content

Commit

Permalink
Fix neutron2snabb parser db schema
Browse files Browse the repository at this point in the history
Fixes expected schema for ml2_port_bindings db table to
match that of 2014.1.4 Neutron schema.

Also adds debug print statements.
  • Loading branch information
dosaboy committed May 18, 2015
1 parent ce5142d commit 7d3313a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/program/snabbnfv/neutron2snabb/neutron2snabb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,36 @@ function create_config (input_dir, output_dir, hostname)
{'tenant_id', 'id', 'name', 'network_id', 'mac_address', 'admin_state_up', 'status', 'device_id', 'device_owner'},
'id')
local port_bindings = parse_csv(input_dir.."/ml2_port_bindings.txt",
{'id', 'host', 'vif_type', 'driver', 'segment', 'vnic_type', 'vif_details', 'profile'},
{'id', 'host', 'vnic_type', 'profile', 'vif_type', 'vif_details', 'driver', 'segment'},
'id')
local secrules = parse_csv(input_dir.."/securitygrouprules.txt",
{'tenant_id', 'id', 'security_group_id', 'remote_group_id', 'direction', 'ethertype', 'protocol', 'port_range_min', 'port_range_max', 'remote_ip_prefix'},
'security_group_id', true)
local secbindings = parse_csv(input_dir.."/securitygroupportbindings.txt",
{'port_id', 'security_group_id'},
'port_id')
print("Parsing neutron db tables")
-- Compile zone configurations.
local zones = {}
for _, port in pairs(ports) do
print("PortID: ", port.id)
local binding = port_bindings[port.id]
-- If the port is a 'snabb' port, lives on our host and is online
-- then we compile its configuration.
print("BindingID ", binding.id, " has driver ", binding.driver)
if binding.driver == "snabb" then
local vif_details = json.decode(binding.vif_details)
-- See /~https://github.com/SnabbCo/snabbswitch/pull/423
local profile = vif_details["binding:profile"]
profile = profile or {}
print("vif_details has hostname ", vif_details.zone_host, "(we want ", hostname, ")")
if vif_details.zone_host == hostname then
local zone_port = vif_details.zone_port
-- Each zone can have multiple port configurtions.
if not zones[zone_port] then zones[zone_port] = {} end
print("admin_state_ip is ", port.admin_state_up)
if port.admin_state_up ~= '0' then
print("Adding zone port '", zone_port, "' to list")
-- Note: Currently we don't use `vif_details.zone_gbps'
-- because its "not needed by the traffic process in the
-- current implementation".
Expand Down

0 comments on commit 7d3313a

Please sign in to comment.