1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00
Roopa Prabhu d2b357167d addons: vrf: vrf_slave: up vrf dev only when all interfaces are being
brought up

Ticket: CM-10954, CM-10953
Reviewed By: julien
Testing Done: ran ifupdown2 smoke and vrf ifup/ifdown testing

- vrf master if not around is brought up when the first slave is brought up
by design (because we want the slaves to be
enslaved to a vrf master before addresses are configured).
and master is not brought up by first because interfaces
are brought up down to top in the dependency tree.

- This patch makes sure a slave brings up a vrf master only
when all interfaces are specified. When an individual interface
is brought up, skip master bring up and throw an error.

- Since the addon modules also need to use the ALL and WITH_DEPENDS
  flags, this patch moves them to the existing global ifupdownflags
  class

- vrf module uses the ifupdownflags.ALL flag to not bring up the master
when only the slave is being brought up

example:
ifup <vrf>     			# brings up the vrf device
ifup <vrf> --with-depends 	# brings up the vrf dev and
				# its slaves
ifup <vrf_slave>		# if vrf master is not around,
				# an error is thrown
ifup <vrf_slave> --with-depends # will still not bring up the vrf master

ifdown <vrf>			# deletes vrf dev and flushes the
				# addresses on vrf slaves
ifup <vrf>			# brings up vrf dev and does not
				# up the adresses on the slaves
ifup <vrf> --with-depends	# will bring up vrf and reapply config
				# on slaves (including addresses)

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2016-05-13 23:42:28 -07:00

24 lines
531 B
Python

#!/usr/bin/env python
#
# Copyright 2015 Cumulus Networks, Inc. All rights reserved.
#
# Author: Roopa Prabhu, roopa@cumulusnetworks.com
#
#
class ifupdownFlags():
def __init__(self):
self.ALL = False
self.FORCE = False
self.DRYRUN = False
self.NOWAIT = False
self.PERFMODE = False
self.CACHE = False
self.WITHDEFAULTS = False
# Flags
self.CACHE_FLAGS = 0x0
flags = ifupdownFlags()