def fn_HasVLAN(self, _input, vlan_filter, vlan_id): """ Check `vlan_id` is within `vlan_filter` expression :param _input: :param vlan_filter: :param vlan_id: :return: """ for ctx in _input: vf = self.resolve_var(ctx, vlan_filter) if not vf: continue vlan = self.resolve_var(ctx, vlan_id) if not vlan: continue if has_vlan(vf, vlan): yield ctx
def test_has_vlan(vlan_filter, vlan, result): assert has_vlan(vlan_filter, vlan) is result