Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20019

Config Change Template error

$
0
0

I am working on a new CCT and I'm running into an error that shows up in the output preview:

 

error.PNG

The part in the above picture that shows "System.Collections.Generic.List..." is supposed to output the user's chosen interface on each respective device.  I am defining a 'string' at the top of the script because I need to append data to the interface name.  Is there a problem with where I am defining this, or how I'm defining it?  I guess the question is, how can I reference a 'foreach' loop from within a defined string? Script follows.

 

/*
.CHANGE_TEMPLATE_DESCRIPTION    This script will configure a pair of Ethernet interfaces as a point-to-point
.PLATFORM_DESCRIPTION    Cisco switches and Juniper routers

.PARAMETER_LABEL @ContextNode
    NCM Node
.PARAMETER_DESCRIPTION @ContextNode    Select the nodes on which to run.

.PARAMETER_LABEL @ASideIP
    A-Side Device Loopback IP Address
.PARAMETER_DESCRIPTION @ASideIP    This is the A-side device's loopback IP address. 
.PARAMETER_LABEL @CustomerPorts    A-Side Customer Port
.PARAMETER_DESCRIPTION @CustomerPorts    Choose the A-Side and Z-Side ports.

.PARAMETER_LABEL @ASideVLAN
    A-Side VLAN ID
.PARAMETER_DESCRIPTION @ASideVLAN    This is the VLAN ID to use on the A-side.  If port-based, just enter 'default'.

.PARAMETER_LABEL @ASideNNI
    A-Side NNI
.PARAMETER_DESCRIPTION @ASideNNI    Is the A-Side an NNI that services multiple customers on one port?
.PARAMETER_DISPLAY_TYPE @ASideNNI    Listbox:1=Yes|2=No 
.PARAMETER_LABEL @ZSideIP    Z-Side Device Loopback IP Address
.PARAMETER_DESCRIPTION @ZSideIP    This is the Z-side device's loopback IP address. 
.PARAMETER_LABEL @ZSideNNI    Z-Side NNI
.PARAMETER_DESCRIPTION @ZSideNNI    Is the Z-Side an NNI that services multiple customers on one port?
.PARAMETER_DISPLAY_TYPE @ZSideNNI    Listbox:1=Yes|2=No

.PARAMETER_LABEL @EXCheck
    EX Series Check
.PARAMETER_DESCRIPTION @EXCheck    If both devices are Juniper, is one side an EX switch?
.PARAMETER_DISPLAY_TYPE @EXCheck    Listbox:1=Yes|2=No 
.PARAMETER_LABEL @ZSideVLAN    Z-Side VLAN ID
.PARAMETER_DESCRIPTION @ZSideVLAN    This is the VLAN ID to use on the Z-side.  If port-based, just enter 'default'.

.PARAMETER_LABEL @ASideInstance
    A-Side Instance or Unit
.PARAMETER_DESCRIPTION @ASideInstance    This is the A-Side service instance (1-4000 for Cisco) or logical unit ID (0-16000 for Juniper).

.PARAMETER_LABEL @ZSideInstance
    Z-Side Instance or Unit
.PARAMETER_DESCRIPTION @ZSideInstance    This is the Z-Side service instance (1-4000 for Cisco) or logical unit ID (0-16000 for Juniper). 
.PARAMETER_LABEL @VCID    Virtual Circuit ID
.PARAMETER_DESCRIPTION @VCID    This is the circuit's virtual circuit ID (typically the same as the customer ID).

.PARAMETER_LABEL @ASideLSP
    A-Side LSP
.PARAMETER_DESCRIPTION @ASideLSP    Used only if both devices are Juniper and one side is an EX-Series switch.  If not used, just type 'default'.  Format: car2.eqix_to_dcs1.ss

.PARAMETER_LABEL @ZSideLSP
    Z-Side LSP
.PARAMETER_DESCRIPTION @ZSideLSP    Used only if both devices are Juniper and one side is an EX-Series switch.  If not used, just type 'default'.  Format: car2.eqix_to_dcs1.ss     
.PARAMETER_LABEL @VLANPop    VLAN Popping
.PARAMETER_DESCRIPTION @VLANPop    Is VLAN popping required on A, Z, or both sides?
.PARAMETER_DISPLAY_TYPE @VLANPop    Listbox:1=None|2=A-Side|3=Z-Side|4=A and Z

.PARAMETER_LABEL @CustomerID
    Customer ID
.PARAMETER_DESCRIPTION @CustomerID    This is the customer ID.
*/

script ConfigureL2Circuit(
                            NCM.Nodes[] @ContextNode,                            NCM.Interfaces[] @CustomerPorts,                            string @ASideNNI,                            string @ZSideNNI,                            string @ASideIP,                            string @ZSideIP,                            string @ASideVLAN,                            string @ZSideVLAN,                            string @ASideInstance,                            string @ZSideInstance,                            string @ASideLSP,                            string @ZSideLSP,                            string @EXCheck,                            string @VLANPop,                            string @VCID,                            string @CustomerID,                            string @Bandwidth )
{
string @BandwidthIn = @Bandwidth + '-ingress'
string @BandwidthOut = @Bandwidth + '-ingress'
string @PortDefA = @CustomerPorts + '.' + @ASideInstance
string @PortDefZ = @CustomerPorts + '.' + @ZSideInstance
string @ASideLSPDef = @ASideLSP + '-' + @CustomerID + 'vcid-' + @VCID
string @ZSideLSPDef = @ZSideLSP + '-' + @CustomerID + 'vcid-' + @VCID    /* Configure A-Side Device */    if (@ContextNode.AgentIP == @ASideIP) {        foreach (@ITF in @CustomerPorts) {            /* Configure ME3600 */            if (@ContextNode.MachineType contains '3600X') {                CLI {                    config t                    interface @ITF.InterfaceName                    description @CustomerID                    no shut                    mtu 9800                    load-interval 30                    storm-control broadcast level 5.00 4.00                    storm-control action shutdown                    no lldp transmit                    no lldp receive                    spanning-tree bpdufilter enable                    spanning-tree bpduguard enable                    switchport mode trunk                    switchport trunk allowed vlan none                }                /* Configure Service Instance */                if (@ASideVLAN == 'default') {                    CLI {                        service instance @ASideInstance ethernet                        description @CustomerID - P2P                        encapsulation default                        l2protocol forward                    }                }                else {                    CLI {                        service instance @ASideInstance ethernet                        description @CustomerID - P2P                        encapsulation dot1q @ASideVLAN                        l2protocol forward                    }                                     }                /* Configure VLAN popping and xconnect */                if (@VLANPop contains 'A') {                    CLI {                        rewrite ingress tag pop 1 symmetric                        xconnect @ZSideIP @VCID encapsulation mpls pw-class Raw-Mode-VC5                        mtu 1600                    }                }                else {                    CLI {                        xconnect @ZSideIP @VCID encapsulation mpls pw-class Raw-Mode-VC5                        mtu 1600                                     }                }            }            else {                /* Configure Juniper M/MX */                if (@ContextNode.MachineType contains 'Juniper M') {                    if (@ASideNNI == 'No') {                        CLI {                            configure                            set interfaces @ITF.InterfaceName apply-groups-except ge-defaults                            set interfaces @ITF.InterfaceName mtu 9192                            set interfaces @ITF.InterfaceName description @CustomerID                            set interfaces @ITF.InterfaceName encapsulation ethernet-ccc                            set interfaces @ITF.InterfaceName enable                        }                    }                    else {                        CLI {                            configure                            set interfaces @ITF.InterfaceName unit @ASideInstance apply-groups-except ge-defaults                            set interfaces @ITF.InterfaceName unit @ASideInstance description @CustomerID                            set interfaces @ITF.InterfaceName unit @ASideInstance encapsulation vlan-ccc family ccc                            set interfaces @ITF.InterfaceName unit @ASideInstance vlan-id @ASideVLAN                        }                    }                    /* Configure VLAN popping and l2circuit or connection */                    if (@VLANPop contains 'A') {                        CLI {                            set interfaces @ITF.InterfaceName unit @ASideInstance input-vlan-map pop                            set interfaces @ITF.InterfaceName unit @ASideInstance output-vlan-map push                        }                    }                    /* Check to see if one end is on an EX Series switch */                    if (@EXCheck == 'Yes') {                        CLI {                            set protocols mpls label-switched-path @ASideLSPDef to @ZSideIP                            set protocols connections remote-interface-switch cid-@CustomerID interface @PortDefA                            set protocols connections remote-interface-switch cid-@CustomerID transmit-lsp @ASideLSPDef                            set protocols connections remote-interface-switch cid-@CustomerID receive-lsp @ZSideLSPDef                        }                    }                    else {                        CLI {                            set protocols l2circuit neighbor @ZSideIP interface @PortDefA virtual-circuit-id @VCID                            set protocols l2circuit neighbor @ZSideIP interface @PortDefA description @CustomerID                            set protocols l2circuit neighbor @ZSideIP interface @PortDefA no-control-word                            set protocols l2circuit neighbor @ZSideIP interface @PortDefA mtu 1600                            set protocols l2circuit neighbor @ZSideIP interface @PortDefA encapsulation-type ethernet                            set protocols l2circuit neighbor @ZSideIP interface @PortDefA pseudowire-status-tlv                         }                    }                }                else {                    /* Configure Juniper EX */                    if (@ContextNode.MachineType contains 'Juniper EX') {                        CLI {                            configure                            set interfaces @ITF.InterfaceName apply-groups-except cust-int-defaults                            set interfaces @ITF.InterfaceName description @CustomerID                            set interfaces @ITF.InterfaceName enable                            set interfaces @ITF.InterfaceName unit 0 family ccc                            set protocols mpls label-switched-path @ASideLSPDef to @ZSideIP                            set protocols connections remote-interface-switch cid-@CustomerID interface @PortDefA                            set protocols connections remote-interface-switch cid-@CustomerID transmit-lsp @ASideLSPDef                            set protocols connections remote-interface-switch cid-@CustomerID receive-lsp @ZSideLSPDef                                                 }                    }                }            }        }    }    /* Configure Z-Side Device */    else {        foreach (@ITF in @CustomerPorts) {            /* Configure Z-Side Device */            if (@ContextNode.AgentIP == @ZSideIP) {                foreach (@ITF in @CustomerPorts) {                    /* Configure ME3600 */                    if (@ContextNode.MachineType contains '3600X') {                        CLI {                            config t                            interface @ITF.InterfaceName                            description @CustomerID                            no shut                            mtu 9800                            load-interval 30                            storm-control broadcast level 5.00 4.00                            storm-control action shutdown                            no lldp transmit                            no lldp receive                            spanning-tree bpdufilter enable                            spanning-tree bpduguard enable                            switchport mode trunk                            switchport trunk allowed vlan none                        }                        /* Configure Service Instance */                        if (@ZSideVLAN == 'default') {                            CLI {                                service instance @ZSideInstance ethernet                                description @CustomerID - P2P                                encapsulation default                                l2protocol forward                            }                        }                        else {                            CLI {                                service instance @ZSideInstance ethernet                                description @CustomerID - P2P                                encapsulation dot1q @ZSideVLAN                                l2protocol forward                            }                                             }                        /* Configure VLAN popping and xconnect */                        if (@VLANPop contains 'Z') {                            CLI {                                rewrite ingress tag pop 1 symmetric                                xconnect @ASideIP @VCID encapsulation mpls pw-class Raw-Mode-VC5                                mtu 1600                            }                        }                        else {                            CLI {                                xconnect @ASideIP @VCID encapsulation mpls pw-class Raw-Mode-VC5                                mtu 1600                                             }                        }                    }                    else {                        /* Configure Juniper M/MX */                        if (@ContextNode.MachineType contains 'Juniper M') {                            if (@ZSideNNI == 'No') {                                CLI {                                    configure                                    set interfaces @ITF.InterfaceName apply-groups-except ge-defaults                                    set interfaces @ITF.InterfaceName mtu 9192                                    set interfaces @ITF.InterfaceName description @CustomerID                                    set interfaces @ITF.InterfaceName encapsulation ethernet-ccc                                    set interfaces @ITF.InterfaceName enable                                }                            }                            else {                                CLI {                                    configure                                    set interfaces @ITF.InterfaceName unit @ZSideInstance apply-groups-except ge-defaults                                    set interfaces @ITF.InterfaceName unit @ZSideInstance description @CustomerID                                    set interfaces @ITF.InterfaceName unit @ZSideInstance encapsulation vlan-ccc family ccc                                    set interfaces @ITF.InterfaceName unit @ZSideInstance vlan-id @ZSideVLAN                                }                            }                            /* Configure VLAN popping and l2circuit or connection */                            if (@VLANPop contains 'Z') {                                CLI {                                    set interfaces @ITF.InterfaceName unit @ZSideInstance input-vlan-map pop                                    set interfaces @ITF.InterfaceName unit @ZSideInstance output-vlan-map push                                }                            }                            /* Check to see if one end is on an EX Series switch */                            if (@EXCheck == 'Yes') {                                CLI {                                    set protocols mpls label-switched-path @ZSideLSPDef to @ASideIP                                    set protocols connections remote-interface-switch cid-@CustomerID interface @PortDefZ                                    set protocols connections remote-interface-switch cid-@CustomerID transmit-lsp @ZSideLSPDef                                    set protocols connections remote-interface-switch cid-@CustomerID receive-lsp @ASideLSPDef                                }                            }                            else {                                CLI {                                    set protocols l2circuit neighbor @ASideIP interface @PortDefZ virtual-circuit-id @VCID                                    set protocols l2circuit neighbor @ASideIP interface @PortDefZ description @CustomerID                                    set protocols l2circuit neighbor @ASideIP interface @PortDefZ no-control-word                                    set protocols l2circuit neighbor @ASideIP interface @PortDefZ mtu 1600                                    set protocols l2circuit neighbor @ASideIP interface @PortDefZ encapsulation-type ethernet                                    set protocols l2circuit neighbor @ASideIP interface @PortDefZ pseudowire-status-tlv                                 }                            }                        }                        else {                            /* Configure Juniper EX */                            if (@ContextNode.MachineType contains 'Juniper EX') {                                CLI {                                    configure                                    set interfaces @ITF.InterfaceName apply-groups-except cust-int-defaults                                    set interfaces @ITF.InterfaceName description @CustomerID                                    set interfaces @ITF.InterfaceName enable                                    set interfaces @ITF.InterfaceName unit 0 family ccc                                    set protocols mpls label-switched-path @ZSideLSPDef to @ZSideIP                                    set protocols connections remote-interface-switch cid-@CustomerID interface @PortDefZ                                    set protocols connections remote-interface-switch cid-@CustomerID transmit-lsp @ZSideLSPDef                                    set protocols connections remote-interface-switch cid-@CustomerID receive-lsp @ASideLSPDef                                }                            }                        }                    }                }            }        }    }
}

Viewing all articles
Browse latest Browse all 20019

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>