Welcome to Infoblox NetMRI Community Sign in | Join | Help
in Search

Excluding devices from group membership

Last post 03-05-2010 3:41 PM by mjensen. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 03-05-2010 11:39 AM

    • tslattery
    • Top 10 Contributor
    • Joined on 09-12-2007
    • Chesapeake Netcraftsmen

    Excluding devices from group membership

    I have two device groups and want to create a third group that's the set of devices from group 1 that is not also in group 2. 

    Group 1 is all routers and switches.

    Group 2 is a sub-set that includes at least one model of each device type in the network.

    I want a third group that is the set of all devices other than those in Group 2 (i.e. Group 3 = Group 1 - Group2).  Expressing it as boolean, I'd like

    !(G1 && G2)

    According to boolean logic rules, this is equivalent to

    (!G1 || !G2)

    Both require the 'not' operator, which I don't see in the documentation.  Is there a way to do what I need?  There are 600 devices in G1 and 30 in G2.  There isn't a common naming scheme that allows me to identify the members of G3 other than excluding the members of G2 from G1.  Thanks!

     

     

  • 03-05-2010 12:01 PM In reply to

    Re: Excluding devices from group membership

    All of our device groups definitions were migrated from 2.x to 3.x to 4.x but when I display their membership criteria, they still use the same syntax as before, which doesn't resemble yours.

    Why won't something like this work?

    memberOf ["G1"] and not memberOf ["G2"] and $Assurance > 75

  • 03-05-2010 12:27 PM In reply to

    • tslattery
    • Top 10 Contributor
    • Joined on 09-12-2007
    • Chesapeake Netcraftsmen

    Re: Excluding devices from group membership

    Sorry, I was using boolean syntax instead of NetMRI syntax, because I don't see that NetMRI offers what's required.

    Specifically, I don't see a 'not' operator, which is what I need.  I would like to use a syntax of:

    not (memberOf ["G1"] and memberOf ["G2"])

    Is the 'not' operator available?

    The online docs say:

    Logical Operators

    The following logical operators can be used to combine comparison sub-expressions:

    and, &, &&   boolean AND

    or, |, ||    boolean OR

    (, )         grouping

    Examples:

    $Vendor eq "Cisco" and $Type eq "Router"

    ($Vendor eq "Juniper" and $Type eq "Router")
    or ($Vendor eq "Cisco" and $Type in ["Router", "Switch"])

    memberOf ["Routing Group”"] and $IPAddress in [10.1.0.0/16, 10.2.3.45]

     

  • 03-05-2010 1:03 PM In reply to

    Re: Excluding devices from group membership

    I agree that the doc doesn't list "not" as a logical operator for that.  So try it and see if it works?  Geeked

    Or use this instead:

    (memberOf ["G1"] and not memberOf ["G2"]) or (memberOf ["G2"] and not memberOf ["G1"])

     

  • 03-05-2010 1:24 PM In reply to

    Re: Excluding devices from group membership

    Can you post the syntax for each of your groups?

    Patrick Voglesang
    SE Director South East / FeferalField, Infoblox
    (T) +1 410 573 2267 (M) +1 724 272 1042 (F) +1 410 573 9774
    (E) pvogelsang@infoblox.com www.infoblox.com

  • 03-05-2010 1:41 PM In reply to

    • tslattery
    • Top 10 Contributor
    • Joined on 09-12-2007
    • Chesapeake Netcraftsmen

    Re: Excluding devices from group membership

    Group 1 has devices with names starting with 3 digits and a hyphen.  It contains 605 devices:

    $Name like /^[0-9][0-9][0-9]-.*/ and
    $Type not like /unknown/

    Group 2 consists of specific devices.  It contains 33 devices:

    memberOf ["G1"] and
    ( $Name like /^016-.*/ or
     $Name like /^493-.*/ or
     $Name like /^166-.*/ or
     $Name like /^393-.*/ or
     $Name like /^355-.*/ or
     $Name like /^531-.*/ or
     $Name like /^499-.*/ or
     $Name like /^022-.*/ or
     $Name like /^030-.*/ )

    For G3, I tried the following, which gave me the same set as G1, or 605 devices:

    memberOf ["G1"] and ($Name not like /^016-.*/ or
    $Name not like /^493-.*/ or
    $Name not like /^166-.*/ or
    $Name not like /^393-.*/ or
    $Name not like /^355-.*/ or
    $Name not like /^531-.*/ or
    $Name not like /^499-.*/ or
    $Name not like /^022-.*/ or
    $Name not like /^030-.*/ or
    $Name not like /^406-.*/ )

     

  • 03-05-2010 1:53 PM In reply to

    Re: Excluding devices from group membership

    I tried this and it worked as marty thought it would :)

    memberOf ["Routing"] and not memberOf ["Switching"]

    Patrick Voglesang
    SE Director South East / FeferalField, Infoblox
    (T) +1 410 573 2267 (M) +1 724 272 1042 (F) +1 410 573 9774
    (E) pvogelsang@infoblox.com www.infoblox.com

  • 03-05-2010 2:02 PM In reply to

    • mjensen
    • Top 25 Contributor
    • Joined on 04-24-2009
    • Austin, Texas

    Re: Excluding devices from group membership

    "not memberOf" is a valid comparison operator.  I just did a quick test with these definitions:

     

    Group1: $IPAddress in [192.168.0.0/16]

    Group2: $Vendor eq "Cisco"

    Group3: memberOf ["Group1"] and not memberOf ["Test2"]

    and it worked as expected, with Group3 containing all non-Cisco devices with 192.168.0.x addresses.

     

    Marc S. Jensen
    Technical Support Engineer - Infoblox, Inc.
    +1 410-573-2237 mjensen@infoblox.com
  • 03-05-2010 2:09 PM In reply to

    • tslattery
    • Top 10 Contributor
    • Joined on 09-12-2007
    • Chesapeake Netcraftsmen

    Re: Excluding devices from group membership

    Cool!  I'll work with that. Thanks!

  • 03-05-2010 3:28 PM In reply to

    • tslattery
    • Top 10 Contributor
    • Joined on 09-12-2007
    • Chesapeake Netcraftsmen

    Re: Excluding devices from group membership

    Try this one, where two groups are to be aggregated with an 'or' clause and the result of that is to be omitted from the "all devices" group.

    memberOf["All Devices"] and not (memberOf["Config Update Pass 1"] or memberOf["Config Update Pass 2"])

    The error says "Invalid value 'not'."

    However, if I create a fourth group that's Config Update Pass 1 and Config Update Pass 2, then this syntax works:

    memberOf["All Devices"] and not memberOf["Config Update Pass 1and2"]

  • 03-05-2010 3:41 PM In reply to

    • mjensen
    • Top 25 Contributor
    • Joined on 04-24-2009
    • Austin, Texas

    Re: Excluding devices from group membership

    That is correct.  NetMRI does not recognize "not" as a boolean operator -- rather, both "memberOf" and "not memberOf" are recognized as comparison operators.

    In your example, I think this would work:

    memberOf ["All Devices] and not memberOf ["Config Update Pass 1", "Config Update Pass 2"]

     

    Marc S. Jensen
    Technical Support Engineer - Infoblox, Inc.
    +1 410-573-2237 mjensen@infoblox.com
Page 1 of 1 (11 items)