DX NetOps

 View Only
  • 1.  Need help on Regex match for Spectrum NCM

    Broadcom Employee
    Posted Aug 27, 2019 02:29 PM
    Hi Folks

    This is for anyone that can contribute a regex suggestion please. A NCM multi-link block policy in use is utilizing a Regex match but the match is not working - request help on the proper syntax required for a successful regex match - thanks!

    Here's The regex being tested (not working):

    (?m)^inter.+switchport mode
    trunk.+!

    (?s)^desc.+

    How can we find the blocks of text that for example contain "description" of "switchport mode trunk"? 

    The text being matched against:

    interface GigabitEthernet1/1/0/4

     switchport access vlan 99

     switchport mode access

     switchport nonegotiate

     shutdown

     spanning-tree portfast

     spanning-tree guard root

    !

    interface GigabitEthernet1/1/0/5

     description >Uplink to vfdc-jmgm-isomgmt-fw1<

     switchport trunk allowed vlan 3,12,15,16,19,32,133

     switchport mode trunk

     switchport nonegotiate

     spanning-tree portfast trunk

     spanning-tree guard root

    !

    interface GigabitEthernet1/1/0/6

     description >IPv6 SERVER1<

     switchport access vlan 3

     switchport mode access

     switchport nonegotiate

     spanning-tree portfast

     spanning-tree guard root

    !

    interface GigabitEthernet1/1/0/7

     description >IPv6 SERVER2<

     switchport access vlan 3

     switchport mode access

     switchport nonegotiate

     spanning-tree portfast

     spanning-tree guard root

    !

    interface GigabitEthernet1/1/0/8

     description >Uplink to vfdc-jmgm-isomgmt-fw2<

     switchport trunk allowed vlan 3,12,15,16,19,32,133

     switchport mode trunk

     switchport nonegotiate

     spanning-tree portfast trunk

     spanning-tree guard root

    end

    !



    ------------------------------
    Senior Support Engineer
    Broadcom
    ------------------------------


  • 2.  RE: Need help on Regex match for Spectrum NCM

    Broadcom Employee
    Posted Sep 03, 2019 01:21 PM
    Anyone have suggestions on this regex question please? Thank you.

    ------------------------------
    Senior Support Engineer
    Broadcom
    ------------------------------



  • 3.  RE: Need help on Regex match for Spectrum NCM

    Broadcom Employee
    Posted Sep 04, 2019 04:24 AM
    Hi Jason,

    please try this and let us know:

    block start:    (?m)^interface.[a-z|A-Z|0-9|\/]*
    block end:     (?m)^!
    comparison:  \s?switchport mode trunk

    Best Regards
    David Collantes

    ------------------------------
    David Collantes
    Customer Success Architect | Enterprise Software Division
    BROADCOM
    ------------------------------



  • 4.  RE: Need help on Regex match for Spectrum NCM

    Broadcom Employee
    Posted Sep 04, 2019 09:25 AM
    Excellent, thank you. I tested these in https://regex101.com/ and looks like it works well. Appreciate the assistance.

    ------------------------------
    Senior Support Engineer
    Broadcom
    ------------------------------