proc Config_Creation {} { set list {SGI-2-VLAN404_VLAN414 SGI-3-VLAN405_VLAN415 SGI-4-VLAN406_VLAN416 SGI-5-VLAN407_VLAN417 SGI-6-VLAN408_VLAN418 SGI-7-VLAN409_VLAN419 SGI-8-VLAN410_VLAN420 SGI-9-VLAN411_VLAN421} set file [open "APN-Configuration-bulk.txt" w] foreach context_index $list { incr $context_index if {$context_index == "SGI-7-VLAN409_VLAN419"} { set str "\tpdp-type ipv4\n\tbearer-control-mode mixed\n\tselection-mode subscribed sent-by-ms chosen-by-sgsn\n\taccounting-mode none\n\tgtpp group CGF-1 accounting-context SUPPORTZONE\n\tgtpp group CGF-2 accounting-context SUPPORTZONE\n\tgtpp group CGF-3 accounting-context SUPPORTZONE\n\tgtpp group CGF-4 accounting-context SUPPORTZONE\n\tidle-timeout-activity ignore-downlink\n\ttimeout bearer-inactivity gbr 300 volume-threshold uplink 29\n\ttimeout bearer-inactivity non-gbr 900 volume-threshold uplink 29\n\ttimeout bearer-inactivity exclude-default-bearer\n\tassociate qci-qos-mapping QCI_DSCP_APN_MAP\n\tpco-options link-mtu 1430\n\tapn-ambr rate-limit direction downlink burst-size auto-readjust duration 1 violate-action drop\n\tapn-ambr rate-limit direction uplink burst-size auto-readjust duration 1 violate-action drop\n\tims-auth-service Gx\n\taaa group RADIUS-to-MSP\n\tdns primary 198.224.124.247\n\tppp mtu 2000\n\ttimeout idle 14400\n\tip access-group ECS_ACL_in in\n\tip access-group ECS_ACL_out out\n\tip source-violation check drop-limit 0\n\tmediation-device\n\tip context-name $context_index\n\tip address pool name pool_broadband\n\tcc-profile any credit-control-group Gy\n\tcredit-control-client override session-mode per-subscriber\n\tactive-charging rulebase POSTPAID\n\tdata-tunnel mtu 2000\n\texit" puts $file "context $context_index" for {set VRF 7001} {$VRF <=7300} {incr VRF} { puts $file " ip vrf VRF_$VRF\n #exit" } puts $file " ip vrf VRF_7999\n #exit" puts $file " mpls bgp forwarding" for {set VRF 7001} {$VRF <=7300} {incr VRF} { puts $file " ip pool pool_common_$VRF 10.107.0.0 255.255.254.0 private 0 srp-activate group-name pool_common_group_$VRF vrf VRF_$VRF" } puts $file " bfd-protocol\n #exit" set a 0 for {set VRF 7001} {$VRF <=7300} {incr VRF} { incr a puts $file " ip vrf VRF_$VRF\n route-distinguisher 409 $a\n route-target both 409 $a\n #exit" puts $file " address-family ipv4 vrf VRF_$VRF\n maximum-paths ebgp 2\n redistribute connected\n #exit" } puts $file " ip vrf VRF_7999\n route-distinguisher 409 999\n route-target both 409 999\n #exit" puts $file " address-family ipv4 vrf VRF_7999\n maximum-paths ebgp 2\n redistribute connected\n #exit" puts $file " interface Test_UE-01 loopback\n ip vrf forwarding VRF_7001\n ip address 10.107.0.1 255.255.255.255 srp-activate\n #exit" set vrf 7000 for {set i 101} {$i <=400} {incr i} { incr vrf set apn_name common-$i-fn2 set str "\tpdp-type ipv4\n\tbearer-control-mode mixed\n\tselection-mode subscribed sent-by-ms chosen-by-sgsn\n\taccounting-mode none\n\tgtpp group CGF-1 accounting-context SUPPORTZONE\n\tgtpp group CGF-2 accounting-context SUPPORTZONE\n\tgtpp group CGF-3 accounting-context SUPPORTZONE\n\tgtpp group CGF-4 accounting-context SUPPORTZONE\n\tidle-timeout-activity ignore-downlink\n\ttimeout bearer-inactivity gbr 300 volume-threshold uplink 29\n\ttimeout bearer-inactivity non-gbr 900 volume-threshold uplink 29\n\ttimeout bearer-inactivity exclude-default-bearer\n\tassociate qci-qos-mapping QCI_DSCP_APN_MAP\n\tpco-options link-mtu 1430\n\tapn-ambr rate-limit direction downlink burst-size auto-readjust duration 1 violate-action drop\n\tapn-ambr rate-limit direction uplink burst-size auto-readjust duration 1 violate-action drop\n\tims-auth-service Gx\n\taaa group RADIUS-to-MSP\n\tdns primary 198.224.124.247\n\tppp mtu 2000\n\ttimeout idle 14400\n\tip access-group ECS_ACL_in in\n\tip access-group ECS_ACL_out out\n\tip source-violation check drop-limit 0\n\tmediation-device\n\tip context-name $context_index\n\tip address pool name pool_common_$vrf\n\tcc-profile any credit-control-group Gy\n\tcredit-control-client override session-mode per-subscriber\n\tactive-charging rulebase POSTPAID\n\tdata-tunnel mtu 2000\n\texit" puts $file " apn $apn_name\n$str" } } elseif {$context_index == "SGI-8-VLAN410_VLAN420"} { puts $file "context $context_index" for {set VRF 8001} {$VRF <=8300} {incr VRF} { puts $file " ip vrf VRF_$VRF\n #exit" } puts $file " ip vrf VRF_8999\n #exit" puts $file " mpls bgp forwarding" for {set VRF 8001} {$VRF <=8300} {incr VRF} { puts $file " ip pool pool_common_$VRF 10.107.0.0 255.255.254.0 private 0 srp-activate group-name pool_common_group_$VRF vrf VRF_$VRF" } puts $file " bfd-protocol\n #exit" set b 0 for {set VRF 8001} {$VRF <=8300} {incr VRF} { incr b puts $file " ip vrf VRF_$VRF\n route-distinguisher 410 $b\n route-target both 410 $b\n #exit" puts $file " address-family ipv4 vrf VRF_$VRF\n maximum-paths ebgp 2\n redistribute connected\n #exit" } puts $file " ip vrf VRF_8999\n route-distinguisher 410 999\n route-target both 410 999\n #exit" puts $file " address-family ipv4 vrf VRF_8999\n maximum-paths ebgp 2\n redistribute connected\n #exit" puts $file " interface Test_UE-01 loopback\n ip vrf forwarding VRF_8001\n ip address 10.107.0.1 255.255.255.255 srp-activate\n #exit" set vrf 8000 for {set i 401} {$i <=700} {incr i} { set apn_name common-$i-fn2 incr vrf set str "\tpdp-type ipv4\n\tbearer-control-mode mixed\n\tselection-mode subscribed sent-by-ms chosen-by-sgsn\n\taccounting-mode none\n\tgtpp group CGF-1 accounting-context SUPPORTZONE\n\tgtpp group CGF-2 accounting-context SUPPORTZONE\n\tgtpp group CGF-3 accounting-context SUPPORTZONE\n\tgtpp group CGF-4 accounting-context SUPPORTZONE\n\tidle-timeout-activity ignore-downlink\n\ttimeout bearer-inactivity gbr 300 volume-threshold uplink 29\n\ttimeout bearer-inactivity non-gbr 900 volume-threshold uplink 29\n\ttimeout bearer-inactivity exclude-default-bearer\n\tassociate qci-qos-mapping QCI_DSCP_APN_MAP\n\tpco-options link-mtu 1430\n\tapn-ambr rate-limit direction downlink burst-size auto-readjust duration 1 violate-action drop\n\tapn-ambr rate-limit direction uplink burst-size auto-readjust duration 1 violate-action drop\n\tims-auth-service Gx\n\taaa group RADIUS-to-MSP\n\tdns primary 198.224.124.247\n\tppp mtu 2000\n\ttimeout idle 14400\n\tip access-group ECS_ACL_in in\n\tip access-group ECS_ACL_out out\n\tip source-violation check drop-limit 0\n\tmediation-device\n\tip context-name $context_index\n\tip address pool name pool_common_$vrf\n\tcc-profile any credit-control-group Gy\n\tcredit-control-client override session-mode per-subscriber\n\tactive-charging rulebase POSTPAID\n\tdata-tunnel mtu 2000\n\texit" puts $file " apn $apn_name\n$str" } } elseif {$context_index == "SGI-9-VLAN411_VLAN421"} { puts $file "context $context_index" for {set VRF 9001} {$VRF <=9300} {incr VRF} { puts $file " ip vrf VRF_$VRF\n #exit" } puts $file " ip vrf VRF_9999\n #exit" puts $file " mpls bgp forwarding" for {set VRF 9001} {$VRF <=9300} {incr VRF} { puts $file " ip pool pool_common_$VRF 10.107.0.0 255.255.254.0 private 0 srp-activate group-name pool_common_group_$VRF vrf VRF_$VRF" } puts $file " bfd-protocol\n #exit" set c 0 for {set VRF 9001} {$VRF <=9300} {incr VRF} { incr c puts $file " ip vrf VRF_$VRF\n route-distinguisher 411 $c\n route-target both 411 $c\n #exit" puts $file " address-family ipv4 vrf VRF_$VRF\n maximum-paths ebgp 2\n redistribute connected\n #exit" } puts $file " ip vrf VRF_9999\n route-distinguisher 411 999\n route-target both 411 999\n #exit" puts $file " address-family ipv4 vrf VRF_9999\n maximum-paths ebgp 2\n redistribute connected\n #exit" puts $file " interface Test_UE-01 loopback\n ip vrf forwarding VRF_9001\n ip address 10.107.0.1 255.255.255.255 srp-activate\n #exit" set vrf 9000 for {set i 701} {$i <=1000} {incr i} { incr vrf set apn_name common-$i-fn2 set str "\tpdp-type ipv4\n\tbearer-control-mode mixed\n\tselection-mode subscribed sent-by-ms chosen-by-sgsn\n\taccounting-mode none\n\tgtpp group CGF-1 accounting-context SUPPORTZONE\n\tgtpp group CGF-2 accounting-context SUPPORTZONE\n\tgtpp group CGF-3 accounting-context SUPPORTZONE\n\tgtpp group CGF-4 accounting-context SUPPORTZONE\n\tidle-timeout-activity ignore-downlink\n\ttimeout bearer-inactivity gbr 300 volume-threshold uplink 29\n\ttimeout bearer-inactivity non-gbr 900 volume-threshold uplink 29\n\ttimeout bearer-inactivity exclude-default-bearer\n\tassociate qci-qos-mapping QCI_DSCP_APN_MAP\n\tpco-options link-mtu 1430\n\tapn-ambr rate-limit direction downlink burst-size auto-readjust duration 1 violate-action drop\n\tapn-ambr rate-limit direction uplink burst-size auto-readjust duration 1 violate-action drop\n\tims-auth-service Gx\n\taaa group RADIUS-to-MSP\n\tdns primary 198.224.124.247\n\tppp mtu 2000\n\ttimeout idle 14400\n\tip access-group ECS_ACL_in in\n\tip access-group ECS_ACL_out out\n\tip source-violation check drop-limit 0\n\tmediation-device\n\tip context-name $context_index\n\tip address pool name pool_common_$vrf\n\tcc-profile any credit-control-group Gy\n\tcredit-control-client override session-mode per-subscriber\n\tactive-charging rulebase POSTPAID\n\tdata-tunnel mtu 2000\n\texit" puts $file " apn $apn_name\n$str" } } } close $file } Config_Creation
# # Data for one employee # dict set employeeInfo 12345-A forenames Joe # dict set employeeInfo 12345-A surname Schmoe # dict set employeeInfo 12345-A street {147 Short Street} # dict set employeeInfo 12345-A city Springfield # dict set employeeInfo 12345-A phone 555-1234 # # Data for another employee # dict set employeeInfo 98372-J forenames Anne # dict set employeeInfo 98372-J surname Other # dict set employeeInfo 98372-J street {32995 Oakdale Way} # dict set employeeInfo 98372-J city Springfield # dict set employeeInfo 98372-J phone 555-8765 # # The above data probably ought to come from a database... # puts $employeeInfo # # Print out some employee info # set i 0 # puts "There are [dict size $employeeInfo] employees" # dict for {key info} $employeeInfo { # puts "Employee #[incr i]: $key" # dict with info { # puts " Name: $forenames $surname" # puts " Address: $street, $city" # puts " Telephone: $phone" # } # } # # Another way to iterate and pick out names... # foreach id [dict keys $employeeInfo] { # puts "Hello, [dict get $employeeInfo $id forenames]!" # } dict set allPools blue members {{memberState Up port 80 ipAddress 10.11.19.87 hostname dynamictestblue-1} {memberState Down port 80 ipAddress 10.11.19.11 hostname dynamictestblue-2}} dict set allPools green members {{memberState Up port 80 ipAddress 10.11.19.88 hostname dynamictestgreen-1} {memberState Down port 80 ipAddress 10.11.19.12 hostname dynamictestgreen-2}} set activeDeployment "blue" set pool_members {} dict for {color colorPoolMembers} ${allPools} { set arrMembers [dict get ${colorPoolMembers} members] foreach poolMember ${arrMembers} { set hostname [dict get ${poolMember} hostname] set address [dict get ${poolMember} ipAddress] set port [dict get ${poolMember} port] set member_state [dict get ${poolMember} memberState] if { [info exists member_state] } { set server_state ${member_state} } else { set server_state "StateNotDefined" } set server_state_string "state user-up" set server_session_string "session user-enabled" switch ${server_state} { "Down" { set server_session_string "session user-disabled" # set server_state_string "state user-down" } "Disabled" { set server_session_string "session user-disabled" } "StateNotDefined" { set server_session_string "" set server_state_string "" } } if { ${color} != ${activeDeployment} } { set server_session_string "session user-disabled" } lappend pool_members "${hostname}:${port} \{ address ${address} ${server_session_string} ${server_state_string} \} " } } puts "Formatted Members: ${pool_members}"
set ns[new simulator] set nf[open out.nam w] $ns .namtrace-all $nf set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] $ns duplex-link $n0 $n2 2mb 10ms DropTail $ns duplex-link $n0 $n1 2mb 10ms RED proc finish{} { global ns nf $ns flush-trace close $nf exec nam out.nam & exit 0 } $ns at 5.0 "finish" $ns run
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more