Commit 6cff4de3 authored by DELABROYE Dimitri's avatar DELABROYE Dimitri

[gen/refapi] add support for port removal on netapi

parent 6f4a41f9
......@@ -51,7 +51,7 @@ def create_network_equipment(network_uid, network, refapi_path, site_uid=nil)
network["linecards"].each do |linecard_index, linecard|
ports = []
linecard.delete("ports").each do |port_index, port|
port = {"uid"=>port} if port.is_a? String
port = { "uid"=> port } if port.is_a? String
if port.is_a? Hash
# complete entries (see bug 8587)
if port['port'].nil? and linecard['port']
......@@ -60,6 +60,12 @@ def create_network_equipment(network_uid, network, refapi_path, site_uid=nil)
if port['kind'].nil? and linecard['kind']
port['kind'] = linecard['kind']
end
if (!linecard['kind'].nil? and port['kind'].nil? and linecard['kind'] == 'node') or
port['kind'] == 'node' and
port['port'].nil?
p = port['uid'].match(/([a-z]*)-([0-9]*)-?(.*)/).captures[2]
port['port'] = p != '' ? p : 'eth0'
end
end
ports[port_index] = port
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment