Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute Tcl Online

tcl

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 


TEST

tcl

#!/usr/bin/tclsh

puts $tcl_version

Execute Tcl Online

tcl

set val(stop) 10

puts $val(stop)

wish

tcl

#!/usr/bin/wishjavascript:;


grid [label .myLabel -background red -text "Hello World" -relief ridge -borderwidth 3]
   -padx 100 -pady 100

l;pk,pk

tcl

#!/usr/bin/tclsh

puts [format "%f" 43.5]
puts [format "%e" 43.5]
puts [format "%d %s" 4 tuts]
puts [format "%s" "Tcl Language"]
puts [format "%x" 40]

Tcl - dict for - Dynamic iApps

tcl

# # 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}"

node link

tcl

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

lrmdups

tcl

puts "Hello World!"
set x 0101010010101
puts $x
puts [lrmdups $x]

vanet

tcl

puts "Hello World!"

Previous 1 ... 4 5 6 7 8 9 10 ... 17 Next
Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.