diff options
author | 2017-07-25 10:37:57 -0700 | |
---|---|---|
committer | 2017-07-25 10:37:57 -0700 | |
commit | 711967ae9639095ce41500bb0e6f80c8b80fab95 (patch) | |
tree | 07f598b35664ddbd269b76f21cf587f5679cab86 /contrail-agent/scripts/vrouter-interfaces.awk | |
parent | efd4f1414b79dd51c6316a73893ade33bc9f668e (diff) |
Contrail charms
Change-Id: I2d259d03f63fce38348b8384e26ac23e3fce44a8
Signed-off-by: Stuart Mackie <wsmackie@juniper.net>
Diffstat (limited to 'contrail-agent/scripts/vrouter-interfaces.awk')
-rw-r--r-- | contrail-agent/scripts/vrouter-interfaces.awk | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/contrail-agent/scripts/vrouter-interfaces.awk b/contrail-agent/scripts/vrouter-interfaces.awk new file mode 100644 index 0000000..d8e5851 --- /dev/null +++ b/contrail-agent/scripts/vrouter-interfaces.awk @@ -0,0 +1,38 @@ +function strip(s) +{ + sub(/^[[:blank:]]+/, "", s) + sub(/[[:blank:]]+$/, "", s) + return s +} + +/^[[:blank:]]*(iface|mapping|auto|allow-[^ ]+|source) / { + s_iface = 0; iface = 0 +} + +$0 ~ "^[[:blank:]]*auto (" interface "|vhost0)[[:blank:]]*$" { print "#" $0; next } + +$0 ~ "^[[:blank:]]*iface (" interface "|vhost0) " { + s_iface = 1 + if ($2 == interface) { + iface = 1 + print "iface", interface, $3, "manual" > interface_cfg + print "iface vhost0", $3, $4 > vrouter_cfg + } + print "#" $0 + next +} + +s_iface == 1 { + if (iface == 1) { + if (match($1, "^address|netmask|broadcast|metric|gateway$")) { + cfg = vrouter_cfg + } else { + cfg = interface_cfg + } + print " " strip($0) > cfg + } + print "#" $0 + next +} + +{ print $0 } |