- self._up_vrf_slave_without_master(ifacename, vrfname, ifaceobj,
- ifaceobj_getfunc)
- rtnetlink_api.rtnl_api.link_set(ifacename, "up")
+ vrf_master_objs = ifaceobj_getfunc(vrfname)
+ if not vrf_master_objs:
+ # this is the case where vrf is assigned to an interface
+ # but user has not provided a vrf interface.
+ # people expect you to warn them but go ahead with the
+ # rest of the config on that interface
+ netlink.link_set_updown(ifacename, "up")
+ self.log_error('vrf master ifaceobj %s not found'
+ %vrfname)
+ return
+ if (ifupdownflags.flags.ALL or
+ ifupdownflags.flags.WITH_DEPENDS or
+ (ifupdownflags.flags.CLASS and
+ ifaceobj.classes and vrf_master_objs[0].classes and
+ Set(ifaceobj.classes).intersection(vrf_master_objs[0].classes))):
+ self._up_vrf_slave_without_master(ifacename, vrfname,
+ ifaceobj,
+ vrf_master_objs)
+ else:
+ master_exists = False
+ else:
+ master_exists = False
+ if master_exists:
+ netlink.link_set_updown(ifacename, "up")
+ else:
+ self.log_error('vrf %s not around, skipping vrf config'
+ %(vrfname), ifaceobj)