diff options
author | Stuart Mackie <wsmackie@juniper.net> | 2016-10-07 12:24:58 -0700 |
---|---|---|
committer | Stuart Mackie <wsmackie@juniper.net> | 2016-10-07 12:24:58 -0700 |
commit | 4faa7f927149a5c4ef7a03523f7bc14523cb9baa (patch) | |
tree | 0be55aa0809cc395e45baeae63db660b4e72fe83 /charms/trusty/neutron-contrail/scripts/vrouter-interfaces.awk | |
parent | 82f1a7eb5535b30a95b1e71ff18c315d40d1e6f0 (diff) |
Charms for Contrail 3.1 with Mitaka
Change-Id: Id37f3b9743d1974e31fcd7cd9c54be41bb0c47fb
Signed-off-by: Stuart Mackie <wsmackie@juniper.net>
Diffstat (limited to 'charms/trusty/neutron-contrail/scripts/vrouter-interfaces.awk')
-rw-r--r-- | charms/trusty/neutron-contrail/scripts/vrouter-interfaces.awk | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/charms/trusty/neutron-contrail/scripts/vrouter-interfaces.awk b/charms/trusty/neutron-contrail/scripts/vrouter-interfaces.awk new file mode 100644 index 0000000..d8e5851 --- /dev/null +++ b/charms/trusty/neutron-contrail/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 } |