Archive

‘学习笔记’ 分类存档

Java Learning – Basic 01

买了IZ0-803认证学习指南,打算好好过一遍JAVA。在看书过程中,突然感慨时代在进步,04-05年在大学学JAVA时,教材烂的跟祥一样,而现在的教材讲的真是浅显易懂呀!

知识点总结:

1. 在java.lang.*是默认import的,这是java的核心包
2. 在上一篇总结里,也简单说明了包的基本概念,它就是分层的概念,也可以理解文件的路径,这样可以把相同名字的类放到不同的package中,方便用反domain的方式引用(如 package com.ocaj.exam.tutorial;)
3. java编译class文件时不能带后缀名,如:

yonzhao2-mac:Desktop zhaoyong$ javac test.java
yonzhao2-mac:Desktop zhaoyong$ ls |grep test
test.class
test.java
yonzhao2-mac:Desktop zhaoyong$ ls -l |grep test
-rw-r--r--   1 zhaoyong  staff         416  2 23 13:29 test.class
-rw-r--r--   1 zhaoyong  staff         108  2 23 09:20 test.java
yonzhao2-mac:Desktop zhaoyong$ 
yonzhao2-mac:Desktop zhaoyong$ java test.class
错误: 找不到或无法加载主类 test.class
yonzhao2-mac:Desktop zhaoyong$ 
yonzhao2-mac:Desktop zhaoyong$ java test
test-classpath

完整阅读

TCL 正则表达式

基本正则表达式:

tcl-regex-01
完整阅读

ASR9k EEM + TCL Interactive Scripting

Requirement:
1. Capture interface tunnel port each 5 minutes, if traffics > X, will capture other information.
2. Store those information to disk0/harddisk.

In fact, the requirement is very easy by Python + CRT, but customer couldn’t find a PC to continue to run python script, so only use EEM + TCL on ASR9k. And in TCL script, I use two function: foreach and scan.

Follow CLI need config before do script, if you change any variable or script, you need re-config “event manager policy tac_te.tcl username cisco”:

aaa authorization eventmanager default local
event manager environment _cron_entry1 */5 * * * *
event manager directory user policy disk0:
event manager policy tac_te.tcl username cisco persist-time 3600 type user

完整阅读

ASR9k EEM+TCL General custom SNMP Trap

If customer want to focus a alarm on their NMS by SNMP Trap, they can config “snmp-server traps syslog”. But if customer no filter feature on NMS, they couldn’t find special alarm in all syslog, now we can use EEM + TCL to match customer requirement.

Follow TCL Script:

::cisco::eem::event_register_syslog pattern $_error_log occurs $_number period $_times maxrun 300
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*

set alarm "***OOB_ERROR Happened!***"

sys_reqinfo_snmp_trapvar var temp oid 1.1.1.1.1.1.1.1 string $alarm
sys_reqinfo_snmp_trap enterprise_oid 1.3.6.1 generic_trapnum 6 specific_trapnum 2 trap_oid 1.1.1.1.1.1.1.1.1.1.1.1.1 trap_var temp

完整阅读

How to sniffer Dummy VLAN on L2VPN ?

什么是dummy vlan?

由于EVC平台在入端口可以通过rewrite命令剥离VLAN tag,这样导致在PW中没有任何tag,在Type 4时会有问题,两边VLAN的QOS无法传递给对端,所以就有了这个所谓的dummy vlan,它不是一个真正的VLAN,他只是传递一些QOS字段并且占一个位。那么dummy VLAN长什么样?其实大鹏之前的文章里已经详细介绍了EVC的各种行为,我这里只是介绍抓dummy VLAN的“心路历程”以及dummy VLAN的“样子”~

测试Topology:

起始测试环境为VPLS BGP auto discovery + LDP Sig,在76的入向抓包
dummy-vlan-topology

测试步骤

1. 默认Type 5,在CE1 ping 带cos 5,ASR9k-1在AC上不配置rewrite,透传的VLAN是否带着802.1p?根据抓包信息,正常带着802.1p,详细看“bgp-ldp-vlan-cos5.pcapng”;另外有个疑问,既然type 5支持VLAN透传,为什么还要Type 4?答案请看文章结束部分
完整阅读

blonde teen swallows load.xxx videos