X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=VNFs%2FDPPD-PROX%2Fhelper-scripts%2Frapid%2Fhelper.lua;h=a5633409d94d57a77b4564db04f79b12722c2123;hb=refs%2Fchanges%2F00%2F73800%2F2;hp=237c385b797bf26fff6ae7300a0a9bf490554a0c;hpb=6f898f1c73d630bf6e5e75ba1b30d261c8301d2a;p=samplevnf.git diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/helper.lua b/VNFs/DPPD-PROX/helper-scripts/rapid/helper.lua index 237c385b..a5633409 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/helper.lua +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/helper.lua @@ -21,6 +21,22 @@ function convertIPToHex(ip) return "IP ADDRESS ERROR" end + local chunks = {ip:match("^(%d+)%.(%d+)%.(%d+)%.(%d+)(/%d+)$")} + if #chunks == 5 then + for i,v in ipairs(chunks) do + if i < 5 then + if tonumber(v) > 255 then + print ("IPV4 ADDRESS ERROR: ", ip) + return "IPV4 ADDRESS ERROR" + end + address_chunks[#address_chunks + 1] = string.format ("%02x", v) + end + end + result = table.concat(address_chunks, " ") + print ("Hex IPV4: ", result) + return result + end + local chunks = {ip:match("^(%d+)%.(%d+)%.(%d+)%.(%d+)$")} if #chunks == 4 then for i,v in ipairs(chunks) do