summaryrefslogtreecommitdiff
path: root/templates/interfaces/ethernet/node.tag/vif/node.def
blob: a1bd652bb49c3bc9e0a989a126877c0a7902f438 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
tag:
priority: 319
type: u32
help: Virtual Local Area Network (VLAN) ID
syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094"
val_help: u32:0-4094; VLAN ID

create: if [ -n "$VAR(./egress-qos)" ]; then
		opt-e=" egress-qos-map $VAR(./egress-qos/@) "
	fi
	if [ -n "$VAR(./ingress-qos)" ]; then
		opt-in=" ingress-qos-map $VAR(./ingress-qos/@) "
	fi
	if ! ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) $opt-e $opt-in
	then echo "Error creating VLAN device $VAR(../@).$VAR(@)"
	     exit 1
        fi
	# if parent is up, then bring VLAN up
	if [ $(( $(cat /sys/class/net/$VAR(../@)/flags) & 1 )) -eq 1 ]
        then ip link set "$VAR(../@).$VAR(@)" up
	fi
	/opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on

delete: [ -d /sys/class/net/$VAR(../@).$VAR(@) ] || exit 0
        ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@)