GRE Functions

emulation gre config

Execute Tester Command ${rt_handle} command=test_control <additional key=value arguments>

Purpose:

Configures GRE tunnels.

Generic Routing Encapsulation (GRE) is a tunneling protocol. It is designed to encapsulate a wide variety of network layer packets inside IP tunneling packets. The original packet is the payload for the final packet. The protocol is used on the Internet to secure virtual private networks.

Synopsis:

Note: M indicates the argument is `Mandatory`.

    emulation gre config
       gre_tnl_type= {4|6} M
       mode=  {create | modify}
       gre_handle= <gre_handle>
       gre_tnl_addr= <a.b.c.d>
       gre_tnl_addr_step= <a.b.c.d>
       gre_tnl_addr_count= <1-2147483647>
       gre_src_mode= {fixed|increment}
       gre_src_addr= <a.b.c.d>
       gre_src_addr_step= <a.b.c.d>
       gre_src_addr_count= <1-2147483647>
       gre_dst_mode= {fixed|increment}
       gre_dst_addr= <a.b.c.d>
       gre_dst_addr_step= <a.b.c.d>
       gre_dst_addr_count= <1-2147483647>
       gre_checksum= {0|1}
       gre_keepalive= {true|false}
       gre_keepalive_interval= <integer>
       gre_keepalive_retries= <integer>
       gre_count= <1-10000>
       gre_in_key= <in_key>
       gre_out_key= <out_key>
       gre_prefix_len= <integer>
       gre_src_mac_addr= {<aaaa.bbbb.cccc> | <aaaa:bbbb:cccc> |<aa.bb.cc.dd.ee.ff> |
                     <aa:bb:cc:dd:ee:ff> |<aabb-cc-dd-ee-ff>}
       gre_src_mac_addr_step= {<aaaa.bbbb.cccc> | <aaaa:bbbb:cccc> | <aa.bb.cc.dd.ee.ff> |
                     <aa:bb:cc:dd:ee:ff> |<aabb-cc-dd-ee-ff>}
       gre_port_handle= <port_handle>
       gre_encapsulation= {ETHERNET_II | ETHERNET_II_VLAN | ETHERNET_II_QINQ }
       gre_vlan_id= <0-4095>
       gre_vlan_id_count= <1-4096>
       gre_vlan_id_step= <0-4095>
       gre_vlan_user_priority= <0-7>
       gre_vlan_outer_id= <0-4095>
       gre_vlan_outer_id_count= <1-4096>
       gre_vlan_outer_id_step= <0-4095>
       gre_vlan_outer_user_priority= <0-7>
       gre_seqnum_enabled= {true | false}
       upper_layer= {true|false}
       upper_layer_version= {ipv4|ipv6|ipv4v6}
       upper_layer_intf_ip_addr= <a.b.c.d>
       upper_layer_intf_ip_addr_step= <a.b.c.d>
       upper_layer_gateway_ip_addr= <a.b.c.d>
       upper_layer_gateway_ip_addr_step= <a.b.c.d>
       upper_layer_intf_prefix_len= <1-32>
       upper_layer_resolve_gateway_mac= {true|false}
       upper_layer_intf_ipv6_addr= <aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh>
       upper_layer_ipv6_resolve_gateway_mac= {true|false}
       upper_layer_gateway_mac= <aa:bb:cc:dd:ee:ff>
       upper_layer_ipv6_gateway_mac= <aa:bb:cc:dd:ee:ff>
       upper_layer_intf_ipv6_addr_step= <aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh>
       upper_layer_intf_ipv6_prefix_len= <1-128>
       upper_layer_gateway_ipv6_addr= <aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh>
       upper_layer_gateway_ipv6_addr_step= <aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh>
       upper_layer_traffic_class= <0-255>
       upper_layer_link_local_ipv6_addr= <aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh>
       upper_layer_link_local_ipv6_addr_step= <aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh>
       upper_layer_link_local_ipv6_prefix_len= <0-128>

Arguments:

mode
                `Spirent Extension (for Spirent HLTAPI only).`

                Specifies the action to perform. Possible values are::


                 create - Creates GRE clients

                 modify - Changes the configurations for the GRE clients
                         identified by gre_handle. You must specify gre_handle.

                The default is create.

                Note: Values for gre_count, gre_tnl_addr_count,
                     gre_src_addr_count, gre_dst_addr_count, gre_vlan_id_count,
                     gre_vlan_outer_id_count, gre_encapsulation, gre_tnl_type,
                     and gre_port_handle cannot be modified.

gre_handle
                `Spirent Extension (for Spirent HLTAPI only).`

                Gets GRE handle from the return value of the ``link config`` function,
                or Layer 3 functions such as BGP, ISIS, LDP, MPLS, OSPF, PIM,
                RIP, and RSVP.

gre_tnl_type
                Specifies whether the tunnel has an IPv4 or IPv6 address. This
                argument is `Mandatory`.

gre_tnl_addr
                Defines the IPv4 or IPv6 gateway address of the GRE tunnel.

gre_tnl_addr_step
                Configures the IPv4 or IPv6 gateway address for multiple tunnels.
                Use this argument with the gre_tnl_addr argument.

gre_tnl_addr_count
                The number of source IP addresses to generate for a
                tunnel. Possible values range from 1 to 2147483647. The
                default is 1.

gre_src_mode
                Specifies how Spirent HLTAPI will assign the IP
                addresses for a particular tunnel. Possible values are::


                 fixed - The source IP address is the same for all tunnels.

                 increment - For all packets, the source IP address increments
                           by the step specified in the gre_src_addr_step
                           argument.

gre_src_addr
                Specifies the source IP address of the first generated
                packet. The default is 0.0.0.0.

gre_src_addr_step
                Indicates both the step value and the prefix length that
                Spirent HLTAPI applies to the specified source address
                (gre_src_addr). The format of the gre_src_addr_step value is an
                IPv4 address, for example, 0.0.1.0. Use a single decimal
                digit equal to a power of 2; the remaining three digits must
                be zero (0). The numeric value identifies a bit location in
                the address; the location determines the prefix length.
                Spirent HLTAPI also uses the value to increment the host
                ID portion of the address.

gre_src_addr_count
                The number of source IPv4 or IPv6 addresses to generate
                for a stream. Possible values range from 1 to 2147483647. The
                default is 1.

gre_dst_mode
                Specifies how Spirent HLTAPI will assign the IP
                addresses for a particular stream. Possible values are::


                 fixed - The destination IP address is the same for all
                        packets.

                 increment - For all packets, the destination IP address
                       increments by the step specified in the
                       gre_dst_addr_step argument.

gre_dst_addr
                Specifies the destination IP address of the first generated
                packet. The default is 0.0.0.0.

gre_dst_addr_step
                Indicates both the step value and the prefix length that
                Spirent HLTAPI applies to the specified destination address
                (gre_dst_addr). The format of the gre_dst_addr_step value is an
                IPv4 address, for example, 0.0.1.0. Use a single decimal
                digit equal to a power of 2; the remaining three digits must
                be zero (0). The numeric value identifies a bit location in
                the address; the location determines the prefix length.
                Spirent HLTAPI also uses the value to increment the host
                ID portion of the address.

gre_dst_addr_count
                The number of destination IPv4 or IPv6 addresses to generate
                for a stream. Possible values range from 1 to 2147483647. The
                default is 1.

gre_checksum
                Verifies that packets are not corrupted. Possible values are
                0 (not corrupted) and 1 (corrupted). The default is 0.

gre_keepalive
                Enables or disables keepalive for GRE tunnel.
                Possible Values: true or false. The default is false.

gre_keepalive_interval
                Specifies the amount of time, in seconds, between KEEPALIVE messages.
                The default is 10.

gre_keepalive_retries
                Specifies the number of retries to send before tunnel expires.
                The default is 0.

gre_in_key
                Defines the GRE tunnel In key. Spirent HLTAPI will automatically
                change the value to the GRE tunnel Out key once gre_out_key is
                specified.

gre_out_key
                Defines the GRE tunnel Out key.

gre_prefix_len
                `Spirent Extension (for Spirent HLTAPI only).`

                Defines the length (in bits) of the IPv4 tunnel. It must be an
                integer. The default value is 24.

gre_count
                `Spirent Extension (for Spirent HLTAPI only).`

                Specifies the number of emulated GRE tunnel devices.
                Possible values range from 1 to 100000. The default
                value is 1.

gre_src_mac_addr
                `Spirent Extension (for Spirent HLTAPI only).`

                Defines the source MAC address for a Gigabit Ethernet or Gigabit
                Ethernet GBIC interface of the GRE tunnel device. You can enter
                this address in one of the following formats: aaaa.bbbb.cccc
                aaaa:bbbb:cccc aa.bb.cc.dd.ee.ff aa:bb:cc:dd:ee:ff
                aabb-cc-dd-ee-ff

                The default is 0000.0000.0000.

gre_src_mac_addr_step
                `Spirent Extension (for Spirent HLTAPI only).`

                Defines the modifier for the interface MAC address of the
                emulated GRE tunnel device. The default value is
                00:00:00:00:00:01.

gre_port_handle
                `Spirent Extension (for Spirent HLTAPI only).`

                Specifies the handle of the port on which the GRE tunnel device and
                the DHCP or DHCPv6/PD server/client are created, with an L2 GRE
                tunnel link between them. See function link config for more
                details on how to create an L2 GRE tunnel link.

gre_encapsulation
                `Spirent Extension (for Spirent HLTAPI only).`

                Specifies the type of Layer 2 encapsulation for the emulated
                GRE tunnel device. Possible values are::


                 ethernet_ii - Ethernet II

                 ethernet_ii_vlan - Ethernet II with a single VLAN tag

                 ethernet_ii_qinq - Ethernet II with two VLAN tags

                The default value is ethernet_ii.

gre_vlan_id
                `Spirent Extension (for Spirent HLTAPI only).`

                Specifies the starting VLAN ID for the ethernet_ii_vlan
                encapsulation or the ethernet_ii_qinq encapsulation. Possible
                values range from 0 to 4095. The default value is 100. This
                argument is available when gre_encapsulation is set to
                ethernet_ii_qinq or ethernet_ii_vlan.

gre_vlan_id_step
                `Spirent Extension (for Spirent HLTAPI only).`

                Specifies the step size by which the VLAN ID is incremented.
                Possible values range from 0 to 4095. The default value is 1.

gre_vlan_id_count
                `Spirent Extension (for Spirent HLTAPI only).`

                Specifies the number of VLAN IDs to use when generating multiple
                VLANs. Possible values range from 1 to 4096. The default is 1.

gre_vlan_user_priority
                `Spirent Extension (for Spirent HLTAPI only).`

                Specifies the VLAN user priority assigned to emulated device.
                Possible values range from 0 to 7. The default value is 0.

gre_vlan_outer_id
                `Spirent Extension (for Spirent HLTAPI only).`

                Specifies the starting outer VLAN ID for the QinQ encapsulation.
                Possible values range from 0 to 4095. The default value is 100.
                This argument is available when gre_encapsulation is set to
                ethernet_ii_qinq.

gre_vlan_outer_id_step
                `Spirent Extension (for Spirent HLTAPI only).`

                Specifies the step size by which the outer VLAN ID is
                incremented. Possible values range from 0 to 4095. The default
                value is 1.

gre_vlan_outer_id_count
                `Spirent Extension (for Spirent HLTAPI only).`

                Specifies the number of VLAN IDs to use when generating multiple
                outer VLANs. Possible values range from 1 to 4096. The default
                value is 1.

gre_vlan_outer_user_priority
                `Spirent Extension (for Spirent HLTAPI only).`

                Specifies the VLAN priority to assign to the outer VLAN header.
                Possible values range from 0 to 7. The default value is 0.

gre_seqnum_enabled
                `Spirent Extension (for Spirent HLTAPI only).`

                Enables or disables sequence numbers for GRE tunnels.
                Possible Values: true or false. The default is false.

upper_layer
                Specifies whether to configure upper layer interface.

upper_layer_version
                Specifies the version of upper layer interface.

upper_layer_intf_ip_addr
                Specifies the IPv4 address of the upper layer interface.
                The default value is 192.85.1.3. This option can be
                configured when upper_layer is set as 1 and
                upper_layer_version as ipv4.

upper_layer_intf_ip_addr_step
                Specifies the difference between IPv4 interface addresses
                of consecutive devices when multiple GRE devices are
                created. The value must be in IPv4 format. The default
                is 0.0.0.1. This option can be configured when
                upper_layer is set as 1 and upper_layer_version
                is set as ipv4.

 upper_layer_gateway_ip_addr
                Specifies the IPv4 gateway address for the upper layer
                interface. This option can be configured when
                upper_layer is set as 1 and upper_layer_version
                is set as ipv4.

 upper_layer_gateway_ip_addr_step
                Specifies the difference between IPv4 gateway addresses
                of consecutive devices when multiple GRE devices are
                created. The default value is 0.0.0.1. This option can
                be configured when upper_layer is set as 1 and
                upper_layer_version is set as ipv4.

 upper_layer_intf_prefix_len
                Specifies the prefix length for the IP address of the
                upper layer interface. Possible values range from 1 to
                32. The default is 24. This option can be configured
                when upper_layer is set as 1 and upper_layer_version
                is set as ipv4.

 upper_layer_resolve_gateway_mac
                Determines whether to resolve the IPv4 gateway's MAC
                address. Possible values are true and false. The default
                value is true. This option can be configured when
                upper_layer is set as 1 and upper_layer_version
                is set as ipv4.

 upper_layer_intf_ipv6_prefix_len
                Specifies the prefix length for the IPv6 address of the
                upper layer interface. Possible values range from 0 to
                128. The default is 64. This option can be configured
                when upper_layer is set as 1 and upper_layer_version
                is set as ipv6.

 upper_layer_intf_ipv6_addr
                Specifies the IPv6 address of the upper layer interface.
                This option can be configured when upper_layer is set
                as 1 and upper_layer_version is set as ipv6.

 upper_layer_intf_ipv6_addr_step
                Specifies the difference between interface IPv6
                addresses of consecutive devices when multiple GRE
                devices are created. This option can be configured
                when upper_layer is set as 1 and upper_layer_version
                is set as ipv6.

 upper_layer_ipv6_resolve_gateway_mac
                Determines whether to resolve the IPv6 gateway's MAC
                address. Possible values are true and false. The default
                value is true. This option can be configured when
                upper_layer is set as 1 and upper_layer_version
                is set as ipv6.

 upper_layer_gateway_mac
                Specifies the IPv4 gateway's MAC address for the upper
                layer interface. The default value is 00:00:01:00:00:01.
                This option can be configured when upper_layer is set
                as 1 and upper_layer_version is set as ipv4.

 upper_layer_ipv6_gateway_mac
                Specifies the IPv6 gateway's MAC address for the upper
                layer interface. The default value is 00:00:01:00:00:01.
                This option can be configured when upper_layer is set
                as 1 and upper_layer_version is set as ipv6.

 upper_layer_gateway_ipv6_addr
                Specifies the IPv6 gateway address for the upper layer
                interface. This option can be configured when
                upper_layer is set as 1 and upper_layer_version
                is set as ipv6.

 upper_layer_gateway_ipv6_addr_step
                Specifies the difference between IPv6 gateway addresses
                of consecutive devices when multiple GRE devices are
                created. This option can be configured when
                upper_layer is set as 1 and upper_layer_version
                is set as ipv6.

 upper_layer_link_local_ipv6_addr
                Specifies the starting link local IPv6 address for the
                upper layer interface. The value must be in IPv6 format.
                The default is FE80::0. This option can be configured
                when upper_layer is set as 1 and upper_layer_version
                is set as ipv6.

 upper_layer_traffic_class
                Specifies the traffic class of the IPv6 header. Possible
                values range from 0 to 255. The default value is 0. This
                option can be configured when upper_layer is set as 1
                and upper_layer_version is set as ipv6.

 upper_layer_link_local_ipv6_addr_step
                Specifies the difference between link local IPv6 addresses
                of consecutive devices when multiple GRE devices are created.
                The value must be in IPv6 format. The default is ::1. This
                option can be configured when upper_layer is set as 1 and
                upper_layer_version is set as ipv6.

 upper_layer_link_local_ipv6_prefix_len
                Specifies the prefix length for the link local IPv6 address
                of the upper layer interface. Possible values range from 0
                to 128. The default is 64. This option can be configured when
                upper_layer is set as 1 and upper_layer_version is set as ipv6.

Arguments Unsupported by Save as HLTAPI:

None
Return Values:

The emulation gre config function returns a keyed list/dictionary/hash (See Introduction for more information on return value formats) using the following keys (with corresponding data):

config_handle   An array that consists of the GRE tunnel configuration.

status    Success (1) or failure (0) of the operation.
Description:

The emulation gre config function returns an array (config_handle) that consists of the GRE tunnel configuration. You can use the tunnel_handle option for other protocols or the Traffic function if they support GRE.

First, use the emulation_gre_config function to create a configuration array and then pass this array using the tunnel_handle option for the following protocol emulation commands: BGP, ISIS, LDP, OSPF, RIP, PIM, RSVP and Traffic, if they support GRE.

Examples:

The following example configures a GRE tunnel:

emulation gre config
gre_tnl_type= 4
gre_tnl_addr= 10.1.1.1
gre_tnl_addr_step= 0.0.0.1
gre_tnl_addr_count= 2
gre_src_mode= increment
gre_src_addr= 10.1.1.3
gre_src_addr_step= 0.0.0.1
gre_src_addr_count= 2
gre_dst_mode= increment
gre_dst_addr= 10.1.2.4
gre_dst_addr_step= 0.0.0.1
gre_dst_addr_count= 2
gre_in_key=  300
gre_out_key=  300

Sample Output:

{status 1} {config_handle {{gre_tnl_addr_step 0.0.0.1 gre_checksum 0 gre_src_mode
increment gre_vlan_id_count 1 gre_dst_addr_count 2 gre_encapsulation ethernet_ii
gre_keepalive false gre_in_key 300 gre_dst_mode increment gre_dst_addr_step 0.0.0.1
gre_tnl_addr_count 2 gre_count 1 gre_src_addr 10.1.1.3 gre_vlan_outer_id_count 1
gre_keepalive_retries 3 gre_prefix_len 24 optional_args {gre_tnl_addr= 10.1.1.1
gre_tnl_addr_step 0.0.0.1 gre_tnl_addr_count 2 gre_src_mode= increment
gre_src_addr 10.1.1.3 gre_src_addr_step 0.0.0.1 gre_src_addr_count 2 gre_dst_mode=
increment gre_dst_addr 10.1.2.4 gre_dst_addr_step 0.0.0.1 gre_dst_addr_count= 2
gre_in_key 300 gre_out_key= 300} gre_dst_addr 10.1.2.4 gre_src_addr_step 0.0.0.1
`Mandatory`_args {gre_tnl_type= 4} gre_tnl_type 4 gre_out_key 300 gre_tnl_addr 10.1.1.1
mode create gre_qinq_incr_mode outer gre_src_addr_count 2 gre_keepalive_interval 10}}}

This example uses traffic config to call the GRE tunnel handle:

set traffic_status [traffic config
mode= create
port_handle= $rx_port_handle
l3_protocol= $protocol_type
tunnel_handle= $gre_handle
ip_src_addr= $pkt_src(ip)
ip_src_mode= $src_mode
ip_src_step= $src_flow_offset
ip_src_count= $src_flow_count
ip_dst_addr= $pkt_dest(ip)
ip_dst_mode= $dst_flow_mode
ip_dst_step= $dst_flow_offset
ip_dst_count= $dst_flow_count
l3_length= $pkt_size
rate_pps= $rate ]

This example shows how one of the protocols that supports GRE would use the GRE tunnel handle:

set config_status [emulation bgp config
 port_handle=  $port_handle
 tunnel_handle=  $gre_handle
 mode= enable
 ip_version= 4
 count= $my_count
 local_ip_addr= $rtr
 local_addr_step= 0.0.1.0
 remote_ip_addr= $rtr_nbr
 remote_addr_step= 0.0.1.0
 netmask= 24
 neighbor_type= external
 local_as= $my_as
 local_as_step= 1
 local_as_mode= increment
 retries= 0
 retry_time= 120
 active_connect_enable=
 tcp_window_size= 8192
 updates_per_iteration= 1
 hold_time= 90
 local_router_id_enable=
 local_router_id= $rtr
 local_router_id_step= 0.0.1.0
 ipv4_unicast_nlri= ]

The following examples create a GRE server and a DHCPv6 server with an L2 GRE tunnel link:

#To create the DHCP server
  set device_ret0 [emulation dhcp server config
        mode=                           create
        ip_version=                     6
        encapsulation=                  ethernet_ii_vlan
        vlan_id_mode=                   increment
        prefix_pool_step=               1
        prefix_pool_per_server=         100
        prefix_pool_start_addr=         2002:0:0:1::1
        prefix_pool_step_per_server=    0:0:0:1::
        prefix_pool_prefix_length=      64
        port_handle=                    $port2
        preferred_lifetime=             604800
        enable_delayed_auth=            false
        valid_lifetime=                 2592000
        dhcp_realm=                     spirent.com
        enable_reconfigure_key=         false
        reneval_time_percent=           50
        rebinding_time_percent=         80
        server_emulation_mode=          DHCPV6_PD
        local_ipv6_prefix_len=          64
        local_ipv6_addr=                2000:0:0:1::1000
        gateway_ipv6_addr_step=         0:0:0:1::
        local_ipv6_addr_step=           0:0:0:1::
        gateway_ipv6_addr=              2002:0:0:1::1
        vlan_cfi=                       0
        vlan_id=                        500
        vlan_user_priority=             7
        vlan_id_step=                   1
        count=                          6
        mac_addr=                       00:10:94:00:02:01
        mac_addr_step=                  00:00:00:00:00:01
        ]

#To create the GRE server
   set device_ret3 [emulation gre config
       gre_tnl_type=       4
       gre_dst_addr_step=  0.0.0.1
       gre_dst_addr=       1.1.1.1
       gre_checksum=       0
       gre_src_addr=       1.1.1.4
       gre_prefix_len=     32
       gre_tnl_addr=       1.1.1.1
       gre_encapsulation=  ethernet_ii_vlan
       gre_port_handle=    $port2
       gre_vlan_id_step=   1
       gre_vlan_user_pri=  7
       gre_vlan_id=        1
       gre_src_mac_addr= 00:10:94:00:00:04
       gre_src_mac_addr_step= 00:00:00:00:00:01
   ]

 #To link the created devices
   set dhcp_host [keylget device_ret0 handle.dhcpv6_handle]
   set link_ret [::link config
          link_src=       $dhcp_host
          link_dst=       "$device_ret3"
          link_type=      "L2_GRE_Tunnel_Link"]

The following examples create a Layer 3 GRE tunnel and then modify it:

#To configures a GRE tunnel
  set gre_ret [emulation gre config
     gre_encapsulation=      ethernet_ii_qinq
     gre_src_mode=           increment
     gre_dst_mode=           increment
     gre_tnl_type=           4
     gre_dst_addr=           10.1.1.1
     gre_dst_addr_step=      0.0.0.3
     gre_checksum=           0
     gre_src_addr=           20.1.1.1
     gre_tnl_addr_step=      0.0.0.3
     gre_prefix_len=         24
     gre_tnl_addr=           20.1.1.50
     gre_src_addr_step=      0.0.0.3
     ]

#To use the GRE tunnel handle in OSPF
  set device_ret0 [emulation ospf config
     mode=               enable
     tunnel_handle=      $gre_ret
     session_type=       ospfv2
     port_handle=        $port1
     area_id=            0.0.0.0
     hello_interval=     10
     dead_interval=      40
 ]

#To get the GRE handle
  set gre_handle [keylget device_ret0 handle]

#To modify the GRE configuration::

  set gre_ret [emulation gre config
     gre_tnl_type=       4
     mode=               modify
     gre_handle=         $gre_handle
     gre_tnl_addr=               2.2.2.2
     gre_src_addr=       3.3.3.3
     gre_dst_addr=           4.4.4.4
     gre_vlan_id=                300
     gre_in_key=                 400
     gre_out_key=            400 \
     ]

Sample Output:

{tunnel_handle $gre_handle}

End of Procedure Header