summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorRobert Bays <robert@vyatta.com>2012-06-26 13:33:49 -0700
committerRobert Bays <robert@vyatta.com>2012-09-03 10:22:18 -0700
commit49be1d412287ba9b18e1561da34df11a131facb6 (patch)
treef38d75db90db95acb75ed1732a1466bb791aa3be /templates
parent41563446646940ded446e480a26554f7b6b2d0b9 (diff)
downloadvyatta-cfg-quagga-49be1d412287ba9b18e1561da34df11a131facb6.tar.gz
vyatta-cfg-quagga-49be1d412287ba9b18e1561da34df11a131facb6.zip
initial checkin for pbr functionality
Diffstat (limited to 'templates')
-rw-r--r--templates/protocols/static/table/node.def5
-rw-r--r--templates/protocols/static/table/node.tag/interface-route/node.def7
-rw-r--r--templates/protocols/static/table/node.tag/interface-route/node.tag/next-hop-interface/node.def34
-rw-r--r--templates/protocols/static/table/node.tag/interface-route/node.tag/next-hop-interface/node.tag/disable/node.def1
-rw-r--r--templates/protocols/static/table/node.tag/interface-route/node.tag/next-hop-interface/node.tag/distance/node.def4
-rw-r--r--templates/protocols/static/table/node.tag/route/node.def7
-rw-r--r--templates/protocols/static/table/node.tag/route/node.tag/blackhole/distance/node.def4
-rw-r--r--templates/protocols/static/table/node.tag/route/node.tag/blackhole/node.def22
-rw-r--r--templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def38
-rw-r--r--templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/disable/node.def1
-rw-r--r--templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/distance/node.def4
11 files changed, 127 insertions, 0 deletions
diff --git a/templates/protocols/static/table/node.def b/templates/protocols/static/table/node.def
new file mode 100644
index 00000000..3f639363
--- /dev/null
+++ b/templates/protocols/static/table/node.def
@@ -0,0 +1,5 @@
+tag:
+type: u32
+help: Policy route table number
+syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 250; "Must be between (1-250)"
+val_help: u32:1-250; Policy route table number
diff --git a/templates/protocols/static/table/node.tag/interface-route/node.def b/templates/protocols/static/table/node.tag/interface-route/node.def
new file mode 100644
index 00000000..73dd97a3
--- /dev/null
+++ b/templates/protocols/static/table/node.tag/interface-route/node.def
@@ -0,0 +1,7 @@
+tag:
+type: ipv4net
+help: Interface based static route
+syntax:expression: exec "${vyatta_sbindir}/check_prefix_boundary $VAR(@)"
+
+commit:expression: $VAR(./next-hop-interface/) != "" ; \
+ "Must add a next-hop-interface for route $VAR(@)"
diff --git a/templates/protocols/static/table/node.tag/interface-route/node.tag/next-hop-interface/node.def b/templates/protocols/static/table/node.tag/interface-route/node.tag/next-hop-interface/node.def
new file mode 100644
index 00000000..255e572d
--- /dev/null
+++ b/templates/protocols/static/table/node.tag/interface-route/node.tag/next-hop-interface/node.def
@@ -0,0 +1,34 @@
+tag:
+type: txt
+help: Next-hop interface [REQUIRED]
+# show all current interface
+# but syntax accepts any interface since it may exist later (ppp etc)
+allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show all
+
+
+end:
+ if [[ -n "$VAR(../../../table/@)" ]]
+ then
+ table="table $VAR(../../../table/@)"
+ fi
+ if [[ -z "$VAR(./disable)" ]]
+ then
+ if [[ ${COMMIT_ACTION} = 'DELETE' ]]
+ then
+ if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv4 interface; then
+ exit 1;
+ fi
+ vtysh -c "configure terminal" \
+ -c "no ip route $VAR(../@) $VAR(@) $table"
+ else
+ if [[ -n "$VAR(./distance/@)" ]]
+ then
+ dist="$VAR(./distance/@)"
+ fi
+ vtysh -c "configure terminal" \
+ -c "ip route $VAR(../@) $VAR(@) $table $dist";
+ fi
+ else
+ vtysh -c "configure terminal" \
+ -c "no ip route $VAR(../@) $VAR(@) $table"
+ fi
diff --git a/templates/protocols/static/table/node.tag/interface-route/node.tag/next-hop-interface/node.tag/disable/node.def b/templates/protocols/static/table/node.tag/interface-route/node.tag/next-hop-interface/node.tag/disable/node.def
new file mode 100644
index 00000000..92f2ba51
--- /dev/null
+++ b/templates/protocols/static/table/node.tag/interface-route/node.tag/next-hop-interface/node.tag/disable/node.def
@@ -0,0 +1 @@
+help: Disable IPv4 interface static route
diff --git a/templates/protocols/static/table/node.tag/interface-route/node.tag/next-hop-interface/node.tag/distance/node.def b/templates/protocols/static/table/node.tag/interface-route/node.tag/next-hop-interface/node.tag/distance/node.def
new file mode 100644
index 00000000..61abcc65
--- /dev/null
+++ b/templates/protocols/static/table/node.tag/interface-route/node.tag/next-hop-interface/node.tag/distance/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: Distance value for this route
+syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 255; "Must be between (1-255)"
+val_help: u32:1-255; Distance for this route
diff --git a/templates/protocols/static/table/node.tag/route/node.def b/templates/protocols/static/table/node.tag/route/node.def
new file mode 100644
index 00000000..682ca944
--- /dev/null
+++ b/templates/protocols/static/table/node.tag/route/node.def
@@ -0,0 +1,7 @@
+tag:
+type: ipv4net
+help: Static route
+syntax:expression: exec "${vyatta_sbindir}/check_prefix_boundary $VAR(@)"
+
+commit:expression: $VAR(./next-hop/) != "" || $VAR(./blackhole/) != ""; \
+ "Must add either a next-hop or blackhole for route $VAR(@)"
diff --git a/templates/protocols/static/table/node.tag/route/node.tag/blackhole/distance/node.def b/templates/protocols/static/table/node.tag/route/node.tag/blackhole/distance/node.def
new file mode 100644
index 00000000..61abcc65
--- /dev/null
+++ b/templates/protocols/static/table/node.tag/route/node.tag/blackhole/distance/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: Distance value for this route
+syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 255; "Must be between (1-255)"
+val_help: u32:1-255; Distance for this route
diff --git a/templates/protocols/static/table/node.tag/route/node.tag/blackhole/node.def b/templates/protocols/static/table/node.tag/route/node.tag/blackhole/node.def
new file mode 100644
index 00000000..06dbe5ae
--- /dev/null
+++ b/templates/protocols/static/table/node.tag/route/node.tag/blackhole/node.def
@@ -0,0 +1,22 @@
+help: Silently discard pkts when matched
+
+end:
+ if [[ -n "$VAR(../../../table/@)" ]]
+ then
+ table="table $VAR(../../../table/@)"
+ fi
+ if [ ${COMMIT_ACTION} = 'DELETE' ]; then
+ if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv4 address; then
+ exit 1;
+ fi
+
+ vtysh -c "configure terminal" \
+ -c "no ip route $VAR(../@) null0 $table";
+ else
+ if [ -n "$VAR(./distance/@)" ]; then
+ dist="$VAR(./distance/@)";
+ fi;
+
+ vtysh -c "configure terminal" \
+ -c "ip route $VAR(../@) null0 $table $dist";
+ fi;
diff --git a/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def
new file mode 100644
index 00000000..5fb54a8b
--- /dev/null
+++ b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def
@@ -0,0 +1,38 @@
+tag:
+type: ipv4
+help: Next-hop router [REQUIRED]
+end:
+ if [[ -n "$VAR(../../../table/@)" ]]
+ then
+ table="table $VAR(../../../table/@)"
+ fi
+ if [[ -z "$VAR(./disable)" ]]
+ then
+ if [[ ${COMMIT_ACTION} = 'DELETE' ]]
+ then
+ if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv4 address; then
+ exit 1;
+ fi
+ if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \
+ "$VAR(../@)" "$VAR(@)"
+ then
+ vtysh -c "configure terminal" \
+ -c "no ip route $VAR(../@) $VAR(@) $table"
+ fi
+ else
+ if [[ -n "$VAR(./distance/@)" ]]
+ then
+ dist="$VAR(./distance/@)"
+ fi
+ vtysh -c "configure terminal" \
+ -c "ip route $VAR(../@) $VAR(@) $table $dist";
+ fi
+ else
+ if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \
+ "$VAR(../@)" "$VAR(@)"
+ then
+ vtysh -c "configure terminal" \
+ -c "no ip route $VAR(../@) $VAR(@) $table"
+ fi
+ fi
+
diff --git a/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/disable/node.def b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/disable/node.def
new file mode 100644
index 00000000..de3afda4
--- /dev/null
+++ b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/disable/node.def
@@ -0,0 +1 @@
+help: Disable IPv4 next-hop static route
diff --git a/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/distance/node.def b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/distance/node.def
new file mode 100644
index 00000000..61abcc65
--- /dev/null
+++ b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/distance/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: Distance value for this route
+syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 255; "Must be between (1-255)"
+val_help: u32:1-255; Distance for this route