PageRenderTime 57ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/conftest.py

https://bitbucket.org/tedlu/ted
Python | 1129 lines | 1125 code | 4 blank | 0 comment | 0 complexity | de0fe6a8d9084bdc497d2faf4421a808 MD5 | raw file
Possible License(s): GPL-3.0
  1. import platform
  2. import sys
  3. import os
  4. THIS_DIR = os.path.dirname(__file__)
  5. sys.path.insert(0, os.path.join(os.path.abspath(THIS_DIR), "../ciscoconfparse/"))
  6. sys.path.insert(0, os.path.abspath(THIS_DIR))
  7. import pytest
  8. from ciscoconfparse import CiscoConfParse
  9. c01 = """policy-map QOS_1
  10. class GOLD
  11. priority percent 10
  12. !
  13. class SILVER
  14. bandwidth 30
  15. random-detect
  16. !
  17. class BRONZE
  18. random-detect
  19. !
  20. interface Serial 1/0
  21. encapsulation ppp
  22. ip address 1.1.1.1 255.255.255.252
  23. !
  24. interface GigabitEthernet4/1
  25. switchport
  26. switchport access vlan 100
  27. switchport voice vlan 150
  28. power inline static max 7000
  29. !
  30. interface GigabitEthernet4/2
  31. switchport
  32. switchport access vlan 100
  33. switchport voice vlan 150
  34. power inline static max 7000
  35. !
  36. interface GigabitEthernet4/3
  37. switchport
  38. switchport access vlan 100
  39. switchport voice vlan 150
  40. !
  41. interface GigabitEthernet4/4
  42. shutdown
  43. !
  44. interface GigabitEthernet4/5
  45. switchport
  46. switchport access vlan 110
  47. !
  48. interface GigabitEthernet4/6
  49. switchport
  50. switchport access vlan 110
  51. !
  52. interface GigabitEthernet4/7
  53. switchport
  54. switchport access vlan 110
  55. !
  56. interface GigabitEthernet4/8
  57. switchport
  58. switchport access vlan 110
  59. !
  60. access-list 101 deny tcp any any eq 25 log
  61. access-list 101 permit ip any any
  62. !
  63. !
  64. logging 1.1.3.5
  65. logging 1.1.3.17
  66. !
  67. banner login ^C
  68. This is a router, and you cannot have it.
  69. Log off now while you still can type. I break the fingers
  70. of all tresspassers.
  71. ^C
  72. alias exec showthang show ip route vrf THANG""".splitlines()
  73. config_c01_default_gige = """policy-map QOS_1
  74. class GOLD
  75. priority percent 10
  76. !
  77. class SILVER
  78. bandwidth 30
  79. random-detect
  80. !
  81. class BRONZE
  82. random-detect
  83. !
  84. interface Serial 1/0
  85. encapsulation ppp
  86. ip address 1.1.1.1 255.255.255.252
  87. !
  88. default interface GigabitEthernet4/1
  89. interface GigabitEthernet4/1
  90. switchport
  91. switchport access vlan 100
  92. switchport voice vlan 150
  93. power inline static max 7000
  94. !
  95. default interface GigabitEthernet4/2
  96. interface GigabitEthernet4/2
  97. switchport
  98. switchport access vlan 100
  99. switchport voice vlan 150
  100. power inline static max 7000
  101. !
  102. default interface GigabitEthernet4/3
  103. interface GigabitEthernet4/3
  104. switchport
  105. switchport access vlan 100
  106. switchport voice vlan 150
  107. !
  108. default interface GigabitEthernet4/4
  109. interface GigabitEthernet4/4
  110. shutdown
  111. !
  112. default interface GigabitEthernet4/5
  113. interface GigabitEthernet4/5
  114. switchport
  115. switchport access vlan 110
  116. !
  117. default interface GigabitEthernet4/6
  118. interface GigabitEthernet4/6
  119. switchport
  120. switchport access vlan 110
  121. !
  122. default interface GigabitEthernet4/7
  123. interface GigabitEthernet4/7
  124. switchport
  125. switchport access vlan 110
  126. !
  127. default interface GigabitEthernet4/8
  128. interface GigabitEthernet4/8
  129. switchport
  130. switchport access vlan 110
  131. !
  132. access-list 101 deny tcp any any eq 25 log
  133. access-list 101 permit ip any any
  134. !
  135. !
  136. logging 1.1.3.5
  137. logging 1.1.3.17
  138. !
  139. banner login ^C
  140. This is a router, and you cannot have it.
  141. Log off now while you still can type. I break the fingers
  142. of all tresspassers.
  143. ^C
  144. alias exec showthang show ip route vrf THANG""".splitlines()
  145. config_c01_insert_serial_replace = """policy-map QOS_1
  146. class GOLD
  147. priority percent 10
  148. !
  149. class SILVER
  150. bandwidth 30
  151. random-detect
  152. !
  153. class BRONZE
  154. random-detect
  155. !
  156. default interface Serial 2/0
  157. interface Serial 2/0
  158. encapsulation ppp
  159. ip address 1.1.1.1 255.255.255.252
  160. !
  161. interface GigabitEthernet4/1
  162. switchport
  163. switchport access vlan 100
  164. switchport voice vlan 150
  165. power inline static max 7000
  166. !
  167. interface GigabitEthernet4/2
  168. switchport
  169. switchport access vlan 100
  170. switchport voice vlan 150
  171. power inline static max 7000
  172. !
  173. interface GigabitEthernet4/3
  174. switchport
  175. switchport access vlan 100
  176. switchport voice vlan 150
  177. !
  178. interface GigabitEthernet4/4
  179. shutdown
  180. !
  181. interface GigabitEthernet4/5
  182. switchport
  183. switchport access vlan 110
  184. !
  185. interface GigabitEthernet4/6
  186. switchport
  187. switchport access vlan 110
  188. !
  189. interface GigabitEthernet4/7
  190. switchport
  191. switchport access vlan 110
  192. !
  193. interface GigabitEthernet4/8
  194. switchport
  195. switchport access vlan 110
  196. !
  197. access-list 101 deny tcp any any eq 25 log
  198. access-list 101 permit ip any any
  199. !
  200. !
  201. logging 1.1.3.5
  202. logging 1.1.3.17
  203. !
  204. banner login ^C
  205. This is a router, and you cannot have it.
  206. Log off now while you still can type. I break the fingers
  207. of all tresspassers.
  208. ^C
  209. alias exec showthang show ip route vrf THANG""".splitlines()
  210. # A smaller version of c01...
  211. c02 = """policy-map QOS_1
  212. class GOLD
  213. priority percent 10
  214. !
  215. class SILVER
  216. bandwidth 30
  217. random-detect
  218. !
  219. class BRONZE
  220. random-detect
  221. !
  222. interface GigabitEthernet4/1
  223. switchport
  224. switchport access vlan 100
  225. switchport voice vlan 150
  226. power inline static max 7000
  227. !""".splitlines()
  228. ## For historical reasons, I'm use c03 for configs/sample_01.ios (i.e. c01 was
  229. ## already taken)
  230. c03 = """!
  231. service timestamps debug datetime msec localtime show-timezone
  232. service timestamps log datetime msec localtime show-timezone
  233. !
  234. errdisable recovery cause bpduguard
  235. errdisable recovery interval 400
  236. !
  237. aaa new-model
  238. !
  239. ip vrf TEST_100_001
  240. route-target 100:1
  241. rd 100:1
  242. !
  243. interface Serial 1/0
  244. description Uplink to SBC F923X2K425
  245. bandwidth 1500
  246. clock rate 1500
  247. delay 70
  248. encapsulation ppp
  249. ip address 1.1.1.1 255.255.255.252
  250. !
  251. interface Serial 1/1
  252. description Uplink to AT&T
  253. encapsulation hdlc
  254. ip address 1.1.1.9 255.255.255.254
  255. hold-queue 1000 in
  256. hold-queue 1000 out
  257. mpls mtu 1540
  258. ip mtu 1500
  259. mpls ip
  260. !
  261. interface GigabitEthernet4/1
  262. description
  263. switchport
  264. switchport access vlan 100
  265. switchport voice vlan 150
  266. power inline static max 7000
  267. !
  268. interface GigabitEthernet4/2
  269. switchport
  270. switchport access vlan 100
  271. switchport voice vlan 150
  272. power inline static max 7000
  273. speed 100
  274. duplex full
  275. !
  276. interface GigabitEthernet4/3
  277. mtu 9216
  278. switchport
  279. switchport access vlan 100
  280. switchport voice vlan 150
  281. !
  282. interface GigabitEthernet4/4
  283. shutdown
  284. !
  285. interface GigabitEthernet4/5
  286. switchport
  287. switchport access vlan 110
  288. switchport port-security
  289. switchport port-security maximum 3
  290. switchport port-security mac-address sticky
  291. switchport port-security mac-address 1000.2000.3000
  292. switchport port-security mac-address 1000.2000.3001
  293. switchport port-security mac-address 1000.2000.3002
  294. switchport port-security violation shutdown
  295. !
  296. interface GigabitEthernet4/6
  297. description Simulate a Catalyst6500 access port
  298. switchport
  299. switchport access vlan 110
  300. switchport mode access
  301. switchport nonegotiate
  302. switchport port-security
  303. switchport port-security maximum 2
  304. switchport port-security violation restrict
  305. switchport port-security aging type inactivity
  306. switchport port-security aging time 5
  307. spanning-tree portfast
  308. spanning-tree portfast bpduguard
  309. storm-control action shutdown
  310. storm-control broadcast level 0.40
  311. storm-control multicast level 0.35
  312. !
  313. interface GigabitEthernet4/7
  314. description Dot1Q trunk allowing vlans 2-4,7,10,11-19,21-4094
  315. switchport
  316. switchport trunk encapsulation dot1q
  317. switchport mode trunk
  318. switchport trunk native vlan 4094
  319. switchport trunk allowed vlan remove 1,5-10,20
  320. switchport trunk allowed vlan add 7,10
  321. switchport nonegotiate
  322. !
  323. interface GigabitEthernet4/8.120
  324. no switchport
  325. encapsulation dot1q 120
  326. ip vrf forwarding TEST_100_001
  327. ip address 1.1.2.254 255.255.255.0
  328. !
  329. interface ATM5/0/0
  330. no ip address
  331. no ip redirects
  332. no ip unreachables
  333. no ip proxy-arp
  334. load-interval 30
  335. carrier-delay msec 100
  336. no atm ilmi-keepalive
  337. bundle-enable
  338. max-reserved-bandwidth 100
  339. hold-queue 500 in
  340. !
  341. interface ATM5/0/0.32 point-to-point
  342. ip address 1.1.1.5 255.255.255.252
  343. no ip redirects
  344. no ip unreachables
  345. no ip proxy-arp
  346. ip accounting access-violations
  347. pvc 0/32
  348. vbr-nrt 704 704
  349. !
  350. interface ATM5/0/1
  351. shutdown
  352. !
  353. router ospf 100 vrf TEST_100_001
  354. router-id 1.1.2.254
  355. network 1.1.2.0 0.0.0.255 area 0
  356. !
  357. policy-map QOS_1
  358. class GOLD
  359. priority percent 10
  360. !
  361. class SILVER
  362. bandwidth 30
  363. random-detect
  364. !
  365. class BRONZE
  366. random-detect
  367. !
  368. access-list 101 deny tcp any any eq 25 log
  369. access-list 101 permit ip any any
  370. !
  371. !
  372. logging 1.1.3.5
  373. logging 1.1.3.17
  374. !
  375. banner login ^C
  376. This is a router, and you cannot have it.
  377. Log off now while you still can type. I break the fingers
  378. of all tresspassers.
  379. ^C
  380. !
  381. alias exec showthang show ip route vrf THANG""".splitlines()
  382. j01 = """## Last commit: 2015-06-28 13:00:59 CST by mpenning
  383. system {
  384. host-name TEST01_EX;
  385. domain-name pennington.net;
  386. domain-search [ pennington.net lab.pennington.net ];
  387. location {
  388. country-code 001;
  389. building HQ_005;
  390. floor 1;
  391. }
  392. root-authentication {
  393. encrypted-password "$1$y7ArHxKU$zUbdeLfBirgkCsKiOJ5Qa0"; ## SECRET-DATA
  394. }
  395. name-server {
  396. 172.16.3.222;
  397. }
  398. login {
  399. announcement "Test Lab Switch";
  400. message "Unauthorized access is prohibited";
  401. user mpenning {
  402. full-name "Mike Pennington";
  403. uid 1000;
  404. class super-user;
  405. authentication {
  406. encrypted-password "$1$y7ArHxKU$zUbdeLfBirgkCsKiOJ5Qa0"; ## SECRET-DATA
  407. }
  408. }
  409. }
  410. services {
  411. ssh {
  412. root-login allow;
  413. }
  414. telnet;
  415. web-management {
  416. http;
  417. }
  418. }
  419. syslog {
  420. user * {
  421. any emergency;
  422. }
  423. file messages {
  424. any notice;
  425. authorization info;
  426. }
  427. file interactive-commands {
  428. interactive-commands any;
  429. }
  430. }
  431. ntp {
  432. Management {
  433. vlan-id 1;
  434. interface {
  435. ge-0/0/0.0;
  436. ge-0/0/1.0;
  437. ge-0/0/2.0;
  438. ge-0/0/3.0;
  439. }
  440. }
  441. VLAN_FOO {
  442. vlan-id 5;
  443. }
  444. vlan1 {
  445. vlan-id 1;
  446. l3-interface vlan.1;
  447. }
  448. vlan800 {
  449. vlan-id 800;
  450. }
  451. }
  452. ethernet-switching-options {
  453. storm-control {
  454. interface all;
  455. }
  456. }
  457. interfaces {
  458. ge-0/0/0 {
  459. unit 0 {
  460. family ethernet-switching {
  461. port-mode access;
  462. vlan {
  463. members VLAN_FOO;
  464. }
  465. }
  466. }
  467. }
  468. ge-0/0/1 {
  469. unit 0 {
  470. family ethernet-switching {
  471. port-mode trunk;
  472. vlan {
  473. members all;
  474. }
  475. native-vlan-id 1;
  476. }
  477. }
  478. }
  479. vlan {
  480. unit 0 {
  481. family inet {
  482. address 172.16.15.5/22;
  483. }
  484. }
  485. }
  486. }
  487. routing-options {
  488. static {
  489. route 0.0.0.0/0 next-hop 172.16.12.1;
  490. route 192.168.36.0/25 next-hop 172.16.12.1;
  491. }
  492. }""".splitlines()
  493. a01 = """hostname TEST-FW
  494. !
  495. name 1.1.2.20 loghost01
  496. name 1.1.3.10 dmzsrv00
  497. name 1.1.3.11 dmzsrv01
  498. name 1.1.3.12 dmzsrv02
  499. name 1.1.3.13 dmzsrv03
  500. !
  501. interface Ethernet0/0
  502. description Uplink to SBC F923X2K425
  503. nameif OUTSIDE
  504. security-level 0
  505. delay 70
  506. ip address 1.1.1.1 255.255.255.252
  507. !
  508. interface Ethernet0/1
  509. nameif INSIDE
  510. security-level 100
  511. ip address 1.1.2.1 255.255.255.0
  512. !
  513. interface Ethernet0/2
  514. switchport access vlan 100
  515. !
  516. interface VLAN100
  517. nameif DMZ
  518. security-level 50
  519. ip address 1.1.3.1 255.255.255.0
  520. !
  521. object-group network ANY_addrs
  522. network-object 0.0.0.0 0.0.0.0
  523. !
  524. object-group network INSIDE_addrs1
  525. network-object host 1.1.2.1
  526. network-object 1.1.2.2 255.255.255.255
  527. network-object 1.1.2.0 255.255.255.0
  528. !
  529. object-group network INSIDE_addrs1
  530. network-object host 1.1.2.1
  531. network-object 1.1.2.2 255.255.255.255
  532. network-object 1.1.2.0 255.255.255.0
  533. !
  534. object-group service DNS_svc
  535. service-object udp destination eq dns
  536. !
  537. object-group service NTP_svc
  538. service-object udp destination eq ntp
  539. !
  540. object-group service FTP_svc
  541. service-object tcp destination eq ftp
  542. !
  543. object-group service HTTP_svc
  544. service-object tcp destination eq http
  545. !
  546. object-group service HTTPS_svc
  547. service-object tcp destination eq https
  548. !
  549. access-list INSIDE_in extended permit object-group FTP_svc object-group INSIDE_addrs1 object-group ANY_addrs log
  550. access-list INSIDE_in remark Overlap for test purposes
  551. access-list INSIDE_in extended permit ip object-group INSIDE_addrs1 object-group ANY_addrs log
  552. access-list INSIDE_in extended deny ip any any log
  553. !
  554. !
  555. clock timezone CST -6
  556. clock summer-time CDT recurring
  557. !
  558. logging enable
  559. logging timestamp
  560. logging buffer-size 1048576
  561. logging buffered informational
  562. logging trap informational
  563. logging asdm informational
  564. logging facility 22
  565. logging host INSIDE loghost01
  566. no logging message 302021
  567. !
  568. access-group OUTSIDE_in in interface OUTSIDE
  569. access-group INSIDE_in in interface INSIDE
  570. !""".splitlines()
  571. a02 = """: Saved
  572. : Written by mpenning at 05:37:43.184 CDT Sun Jun 29 2015
  573. !
  574. ASA Version 9.0(3)
  575. !
  576. command-alias exec slog show log | i Deny|denied
  577. command-alias exec sacl sh access-list INSIDE_out | e hitcnt=0 |remark|elements
  578. hostname fw
  579. domain-name pennington.net
  580. enable password 2KFQnbNIdI.2KYOU encrypted
  581. xlate per-session deny tcp any4 any4
  582. xlate per-session deny tcp any4 any6
  583. xlate per-session deny tcp any6 any4
  584. xlate per-session deny tcp any6 any6
  585. xlate per-session deny udp any4 any4 eq domain
  586. xlate per-session deny udp any4 any6 eq domain
  587. xlate per-session deny udp any6 any4 eq domain
  588. xlate per-session deny udp any6 any6 eq domain
  589. passwd 2KFQnbNIdI.2KYOU encrypted
  590. names
  591. name 192.0.2.13 Machine01 description machine01
  592. name 192.0.2.17 Machine02_Windows
  593. name 10.0.0.6 Machine03
  594. name 74.125.130.125 GTalk01 description Google talk server
  595. name 74.125.134.125 GTalk02 description Google talk server
  596. name 74.125.139.125 GTalk03 description Google Talk server
  597. name 74.125.142.125 GTalk04 description Google Talk server
  598. name 74.125.192.125 GTalk05 description Google Talk server
  599. name 74.125.140.125 GTalk06 description Google Talk server
  600. name 74.125.137.125 GTalk07
  601. name 74.125.138.125 GTalk08
  602. name 74.125.141.125 GTalk09
  603. name 74.125.136.125 GTalk10
  604. name 74.125.135.125 GTalk11
  605. name 108.160.160.0 AS19679_Dropbox__108-160-160-0__20
  606. name 199.47.216.0 AS19679_Dropbox__199.47.216.0__22
  607. name 173.194.64.109 GmailSMTP01
  608. name 173.194.64.108 GmailSMTP02
  609. name 128.223.51.103 route-views.oregon-ix.net description Route-Views route server
  610. ip local pool SSL_VPN_ADDRS 10.1.1.240-10.1.1.241 mask 255.255.255.0
  611. !
  612. interface Ethernet0/0
  613. description Internet ISP
  614. switchport access vlan 100
  615. !
  616. interface Ethernet0/1
  617. switchport access vlan 200
  618. !
  619. interface Ethernet0/2
  620. switchport access vlan 200
  621. shutdown
  622. !
  623. interface Ethernet0/3
  624. switchport access vlan 200
  625. !
  626. interface Ethernet0/4
  627. switchport access vlan 200
  628. !
  629. interface Ethernet0/5
  630. switchport access vlan 200
  631. !
  632. interface Ethernet0/6
  633. switchport access vlan 200
  634. !
  635. interface Ethernet0/7
  636. shutdown
  637. !
  638. interface Vlan1
  639. no nameif
  640. no security-level
  641. no ip address
  642. !
  643. interface Vlan100
  644. mac-address 0030.dead.beef
  645. nameif OUTSIDE
  646. security-level 0
  647. ip address dhcp setroute
  648. !
  649. interface Vlan200
  650. nameif INSIDE
  651. security-level 100
  652. ip address 192.0.2.1 255.255.255.0
  653. !
  654. banner motd
  655. banner motd Test banner for $(hostname)
  656. banner motd
  657. banner motd *******************************
  658. boot system disk0:/asa903-k8.bin
  659. ftp mode passive
  660. clock timezone CST -6
  661. clock summer-time CDT recurring
  662. dns domain-lookup INSIDE
  663. dns server-group DefaultDNS
  664. name-server Machine01
  665. domain-name pennington.net
  666. object network GTalk01
  667. host 74.125.130.125
  668. description Created during name migration
  669. object network GTalk02
  670. host 74.125.134.125
  671. description Created during name migration
  672. object network GTalk03
  673. host 74.125.139.125
  674. description Created during name migration
  675. object network GTalk04
  676. host 74.125.142.125
  677. description Created during name migration
  678. object network GTalk05
  679. host 74.125.192.125
  680. description Created during name migration
  681. object network GTalk06
  682. host 74.125.140.125
  683. description Created during name migration
  684. object network GTalk07
  685. host 74.125.137.125
  686. description Created during name migration
  687. object network GTalk08
  688. host 74.125.138.125
  689. description Created during name migration
  690. object network GTalk09
  691. host 74.125.141.125
  692. description Created during name migration
  693. object network GTalk10
  694. host 74.125.136.125
  695. description Created during name migration
  696. object network GTalk11
  697. host 74.125.135.125
  698. description Created during name migration
  699. object network AS19679_Dropbox__108-160-160-0__20
  700. subnet 108.160.160.0 255.255.240.0
  701. description Created during name migration
  702. object network AS19679_Dropbox__199.47.216.0__22
  703. subnet 199.47.216.0 255.255.252.0
  704. description Created during name migration
  705. object network Machine01
  706. host 192.0.2.5
  707. description Created during name migration
  708. object network obj_any
  709. subnet 0.0.0.0 0.0.0.0
  710. object network Machine02_Windows
  711. host 192.0.2.17
  712. description Created during name migration
  713. object-group network GoogleTalk
  714. network-object object GTalk01
  715. network-object object GTalk02
  716. network-object object GTalk03
  717. network-object object GTalk04
  718. network-object object GTalk05
  719. network-object object GTalk06
  720. network-object object GTalk07
  721. network-object object GTalk08
  722. network-object object GTalk09
  723. network-object object GTalk10
  724. network-object object GTalk11
  725. object-group service GoogleTalkPorts
  726. service-object tcp destination eq 5222
  727. service-object tcp destination eq https
  728. service-object udp destination range 19302 19309
  729. object-group network Inside
  730. network-object 192.0.2.0 255.255.255.0
  731. network-object 192.0.22.0 255.255.255.0
  732. network-object 192.0.23.0 255.255.255.0
  733. object-group network DROPBOX_AS19679
  734. network-object object AS19679_Dropbox__108-160-160-0__20
  735. network-object object AS19679_Dropbox__199.47.216.0__22
  736. object-group network GOOGLE_addrs
  737. description dig -t TXT _netblocks.google.com 8.8.8.8
  738. network-object 216.239.32.0 255.255.224.0
  739. network-object 64.233.160.0 255.255.224.0
  740. network-object 66.249.80.0 255.255.240.0
  741. network-object 72.14.192.0 255.255.192.0
  742. network-object 209.85.128.0 255.255.128.0
  743. network-object 66.102.0.0 255.255.240.0
  744. network-object 74.125.0.0 255.255.0.0
  745. network-object 64.18.0.0 255.255.240.0
  746. network-object 207.126.144.0 255.255.240.0
  747. network-object 173.194.0.0 255.255.0.0
  748. object-group network SSH_addrs
  749. network-object 192.168.1.0 255.255.255.0
  750. object-group network ANY_addrs
  751. network-object 0.0.0.0 0.0.0.0
  752. object-group network INSIDE_addrs
  753. network-object 192.0.2.0 255.255.255.0
  754. network-object 10.0.0.0 255.0.0.0
  755. object-group service GOOGLE_svc
  756. description Google's push service for Android
  757. service-object tcp destination eq www
  758. service-object tcp destination eq https
  759. service-object tcp destination eq 5228
  760. service-object tcp destination eq 5222
  761. service-object tcp destination eq 587
  762. object-group service TELNET_svc
  763. service-object tcp destination eq telnet
  764. object-group service WHOIS_svc
  765. service-object tcp destination eq whois
  766. object-group service SSH_svc
  767. service-object tcp destination eq ssh
  768. object-group service WEB_svc
  769. description Standard web services - http, https, ftp
  770. service-object tcp destination eq ftp
  771. service-object tcp destination eq www
  772. service-object tcp destination eq https
  773. service-object icmp
  774. object-group service DNS_svc
  775. service-object udp destination eq domain
  776. service-object tcp destination eq domain
  777. object-group network MACHINE01_addrs
  778. network-object object Machine01
  779. object-group service ANDROID_svc
  780. description Google's push service for Android
  781. service-object tcp destination eq 5228
  782. object-group service GMAILSMTP_svc
  783. service-object tcp destination eq 2525
  784. object-group service NTP_svc
  785. service-object udp destination eq ntp
  786. object-group service SKYPE_svc
  787. service-object udp destination eq 5555
  788. object-group service XBOX_svc
  789. service-object tcp destination eq domain
  790. service-object udp destination eq domain
  791. service-object udp destination eq 88
  792. service-object tcp destination eq 3074
  793. service-object udp destination eq 3074
  794. object-group network ANY
  795. object-group service NaverLine_svc
  796. service-object udp destination eq 11000
  797. service-object udp destination range 9401 9405
  798. object-group network NaverLine_addrs
  799. network-object 174.35.127.0 255.255.255.0
  800. object-group network Facebook_addrs
  801. network-object 66.220.144.0 255.255.240.0
  802. network-object 69.63.176.0 255.255.248.0
  803. network-object 69.63.184.0 255.255.248.0
  804. network-object 69.171.224.0 255.255.240.0
  805. network-object 69.171.239.0 255.255.255.0
  806. network-object 69.171.240.0 255.255.240.0
  807. network-object 69.171.253.0 255.255.255.0
  808. network-object 69.171.255.0 255.255.255.0
  809. network-object 74.119.76.0 255.255.252.0
  810. network-object 103.4.96.0 255.255.252.0
  811. network-object 173.252.64.0 255.255.192.0
  812. network-object 204.15.20.0 255.255.252.0
  813. network-object 31.13.24.0 255.255.248.0
  814. network-object 31.13.64.0 255.255.192.0
  815. network-object 31.13.96.0 255.255.224.0
  816. object-group service IP_SLA_PathTrace_svc
  817. service-object udp destination range 33400 33499
  818. object-group service FTP_svc
  819. service-object tcp destination eq ftp
  820. object-group service TeamViewerPorts
  821. service-object tcp destination eq 5938
  822. object-group service SSLVPN_svc
  823. service-object udp destination eq 443
  824. object-group service TEST_PORTS tcp
  825. port-object eq domain
  826. port-object eq smtp
  827. access-list SPLIT_TUNNEL_NETS remark [[ destinations available via the VPN ]]
  828. access-list SPLIT_TUNNEL_NETS standard permit 192.0.2.0 255.255.255.0
  829. access-list NO_SSLVPN_NAT remark [[ prevent inadvertent nat of sslvpn traffic ]]
  830. access-list NO_SSLVPN_NAT extended permit ip 192.0.2.0 255.255.255.0 192.0.2.0 255.255.255.0
  831. access-list INSIDE_in extended deny object-group SKYPE_svc object-group INSIDE_addrs object-group ANY_addrs log disable
  832. access-list INSIDE_in extended permit object-group GOOGLE_svc object-group INSIDE_addrs object-group GOOGLE_addrs log
  833. access-list INSIDE_in extended permit object-group ANDROID_svc object-group INSIDE_addrs object-group GOOGLE_addrs log
  834. access-list INSIDE_in extended permit object-group IP_SLA_PathTrace_svc any host 4.2.2.2 log
  835. access-list INSIDE_in extended permit object-group DNS_svc object-group INSIDE_addrs object-group ANY_addrs log
  836. access-list INSIDE_in extended permit object-group NTP_svc object-group INSIDE_addrs object-group ANY_addrs log
  837. access-list INSIDE_in extended permit object-group TELNET_svc object-group INSIDE_addrs host 128.223.51.103 log
  838. access-list INSIDE_in extended permit object-group FTP_svc object-group INSIDE_addrs object-group ANY_addrs log
  839. access-list INSIDE_in extended permit object-group WEB_svc object-group INSIDE_addrs object-group ANY_addrs log
  840. access-list INSIDE_in extended permit object-group SSH_svc object-group INSIDE_addrs object-group SSH_addrs log
  841. access-list INSIDE_in extended permit object-group GMAILSMTP_svc object-group TSUNAMI_addrs object-group ANY_addrs log
  842. access-list INSIDE_in extended permit object-group WHOIS_svc object-group TSUNAMI_addrs object-group ANY_addrs log
  843. access-list INSIDE_in extended deny ip any4 any4 log
  844. access-list ANY extended permit ip object-group Inside any4
  845. access-list ANY extended permit ip any4 object-group Inside
  846. access-list VOIP extended permit object-group GoogleTalkPorts object-group Inside object-group GoogleTalk
  847. access-list VOIP extended permit object-group GoogleTalkPorts object-group GoogleTalk object-group Inside
  848. access-list MAINTENANCE extended deny ip any4 any4 log
  849. access-list OUTSIDE_in extended deny ip host 4.2.2.2 any4 log
  850. access-list OUTSIDE_in extended permit icmp any4 0.0.0.0 0.0.0.0 unreachable log interval 1
  851. access-list OUTSIDE_in extended permit icmp any4 0.0.0.0 0.0.0.0 time-exceeded log interval 1
  852. access-list OUTSIDE_in extended deny ip any4 any4 log
  853. pager lines 23
  854. logging enable
  855. logging timestamp
  856. logging buffer-size 1048576
  857. logging buffered informational
  858. logging trap informational
  859. logging asdm informational
  860. logging facility 22
  861. logging host INSIDE Machine01
  862. logging class sys buffered informational
  863. no logging message 302021
  864. no logging message 302020
  865. mtu OUTSIDE 1500
  866. mtu INSIDE 1500
  867. ip verify reverse-path interface INSIDE
  868. icmp unreachable rate-limit 1 burst-size 1
  869. asdm image disk0:/asdm-645.bin
  870. no asdm history enable
  871. arp timeout 14400
  872. no arp permit-nonconnected
  873. !
  874. object network obj_any
  875. nat (INSIDE,OUTSIDE) dynamic interface
  876. access-group OUTSIDE_in in interface OUTSIDE
  877. access-group INSIDE_in in interface INSIDE
  878. route INSIDE 10.0.0.0 255.0.0.0 192.0.2.2 1
  879. timeout xlate 3:00:00
  880. timeout pat-xlate 0:00:30
  881. timeout conn 1:00:00 half-closed 0:59:00 udp 0:02:00 icmp 0:00:02
  882. timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
  883. timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
  884. timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
  885. timeout tcp-proxy-reassembly 0:01:00
  886. timeout floating-conn 0:00:00
  887. dynamic-access-policy-record DfltAccessPolicy
  888. user-identity default-domain LOCAL
  889. aaa authentication ssh console LOCAL
  890. aaa authentication enable console LOCAL
  891. aaa authentication http console LOCAL
  892. aaa authorization command LOCAL
  893. aaa local authentication attempts max-fail 16
  894. filter java 1-65535 192.0.2.0 255.255.255.0 0.0.0.0 0.0.0.0
  895. http server enable
  896. http 192.0.2.0 255.255.255.0 INSIDE
  897. snmp-server host INSIDE Machine01 poll community public
  898. snmp-server location ServerRoom
  899. snmp-server contact mike@pennington.net
  900. snmp-server community public
  901. snmp-server enable traps snmp authentication linkup linkdown coldstart
  902. crypto ipsec security-association pmtu-aging infinite
  903. crypto ca trustpoint LOCAL_CERT_fw
  904. enrollment self
  905. fqdn fw.pennington.net
  906. subject-name CN=fw.pennington.net
  907. crl configure
  908. crypto ca trustpool policy
  909. telnet timeout 5
  910. ssh scopy enable
  911. ssh 192.0.2.0 255.255.255.0 INSIDE
  912. ssh 10.0.0.0 255.0.0.0 INSIDE
  913. ssh timeout 60
  914. ssh version 2
  915. console timeout 5
  916. no vpn-addr-assign aaa
  917. no vpn-addr-assign dhcp
  918. dhcpd dns 68.94.156.1 Machine01
  919. dhcpd lease 604800
  920. dhcpd domain pennington.net
  921. dhcpd auto_config OUTSIDE
  922. !
  923. threat-detection basic-threat
  924. threat-detection scanning-threat shun duration 30
  925. threat-detection statistics host
  926. threat-detection statistics port
  927. threat-detection statistics protocol
  928. threat-detection statistics access-list
  929. no threat-detection statistics tcp-intercept
  930. ntp server 17.151.16.20
  931. ntp server 17.151.16.21
  932. ntp server 17.151.16.22
  933. ntp server 17.151.16.23
  934. group-policy SSL_VPN_Policy01 internal
  935. group-policy SSL_VPN_Policy01 attributes
  936. dns-server value 192.0.2.13
  937. vpn-idle-timeout none
  938. vpn-filter none
  939. vpn-tunnel-protocol ssl-client ssl-clientless
  940. split-tunnel-policy tunnelspecified
  941. split-tunnel-network-list value SPLIT_TUNNEL_NETS
  942. default-domain value pennington.net
  943. webvpn
  944. anyconnect keep-installer installed
  945. anyconnect ssl rekey time 30
  946. anyconnect ssl rekey method ssl
  947. anyconnect ask none default anyconnect
  948. username mpenning password dXRTaA5wrZ3OL8gz encrypted privilege 15
  949. tunnel-group DefaultWEBVPNGroup general-attributes
  950. address-pool SSL_VPN_ADDRS
  951. default-group-policy SSL_VPN_Policy01
  952. !
  953. !
  954. policy-map type inspect dns preset_dns_map
  955. parameters
  956. message-length maximum client auto
  957. message-length maximum 512
  958. policy-map global_policy
  959. class inspection_default
  960. inspect dns preset_dns_map
  961. inspect h323 h225
  962. inspect h323 ras
  963. inspect rsh
  964. inspect rtsp
  965. inspect esmtp
  966. inspect sqlnet
  967. inspect skinny
  968. inspect sunrpc
  969. inspect xdmcp
  970. inspect sip
  971. inspect netbios
  972. inspect tftp
  973. inspect ip-options
  974. inspect icmp
  975. inspect http
  976. !
  977. service-policy global_policy global
  978. prompt hostname context
  979. no call-home reporting anonymous
  980. call-home
  981. profile CiscoTAC-1
  982. no active
  983. destination address http https://tools.cisco.com/its/service/oddce/services/DDCEService
  984. destination address email callhome@cisco.com
  985. destination transport-method http
  986. subscribe-to-alert-group diagnostic
  987. subscribe-to-alert-group environment
  988. subscribe-to-alert-group inventory periodic monthly
  989. subscribe-to-alert-group configuration periodic monthly
  990. subscribe-to-alert-group telemetry periodic daily
  991. Cryptochecksum:571d01b7b08342e35db838e9acec00f6
  992. : end""".splitlines()
  993. @pytest.yield_fixture(scope='session')
  994. def c01_default_gigethernets(request):
  995. yield config_c01_default_gige
  996. @pytest.yield_fixture(scope='session')
  997. def c01_insert_serial_replace(request):
  998. yield config_c01_insert_serial_replace
  999. @pytest.yield_fixture(scope='function')
  1000. def parse_c01(request):
  1001. """Preparsed c01"""
  1002. parse_c01 = CiscoConfParse(c01, factory=False)
  1003. yield parse_c01
  1004. @pytest.yield_fixture(scope='function')
  1005. def parse_c01_factory(request):
  1006. """Preparsed c01 with factory option"""
  1007. parse_c01_factory = CiscoConfParse(c01, factory=True)
  1008. yield parse_c01_factory
  1009. @pytest.yield_fixture(scope='function')
  1010. def parse_c02(request):
  1011. """Preparsed c02"""
  1012. parse_c02 = CiscoConfParse(c02, factory=False)
  1013. yield parse_c02
  1014. @pytest.yield_fixture(scope='function')
  1015. def parse_c02_factory(request):
  1016. """Preparsed c02"""
  1017. parse_c02 = CiscoConfParse(c02, factory=True)
  1018. yield parse_c02
  1019. ## parse_c03 yields configs/sample_01.ios
  1020. @pytest.yield_fixture(scope='function')
  1021. def parse_c03(request):
  1022. """Preparsed c03"""
  1023. parse_c03 = CiscoConfParse(c03, factory=False)
  1024. yield parse_c03
  1025. ## parse_c03_factory yields configs/sample_01.ios
  1026. @pytest.yield_fixture(scope='function')
  1027. def parse_c03_factory(request):
  1028. """Preparsed c01 with factory option"""
  1029. parse_c03_factory = CiscoConfParse(c03, factory=True)
  1030. yield parse_c03_factory
  1031. ## parse_j01 yields configs/sample_01.junos
  1032. @pytest.yield_fixture(scope='function')
  1033. def parse_j01(request):
  1034. """Preparsed j01"""
  1035. parse_j01 = CiscoConfParse(j01, syntax='junos', comment='#!', factory=False)
  1036. yield parse_j01
  1037. ## parse_j01_factory yields configs/sample_01.junos
  1038. @pytest.yield_fixture(scope='function')
  1039. def parse_j01_factory(request):
  1040. """Preparsed j01 with factory option"""
  1041. parse_j01_factory = CiscoConfParse(j01, syntax='junos', comment='#!',
  1042. factory=True)
  1043. yield parse_j01_factory
  1044. ## parse_a01 yields the asa configuration
  1045. @pytest.yield_fixture(scope='function')
  1046. def parse_a01(request):
  1047. """Preparsed a01"""
  1048. parse_a01_factory = CiscoConfParse(a01, syntax='asa', factory=False)
  1049. yield parse_a01_factory
  1050. ## parse_a01_factory yields the asa configuration
  1051. @pytest.yield_fixture(scope='function')
  1052. def parse_a01_factory(request):
  1053. """Preparsed a01 with factory option"""
  1054. parse_a01_factory = CiscoConfParse(a01, syntax='asa', factory=True)
  1055. yield parse_a01_factory
  1056. ## config_a02 yields an asa configuration
  1057. @pytest.yield_fixture(scope='function')
  1058. def config_a02(request):
  1059. """Unparsed a02"""
  1060. yield a02
  1061. ## parse_a02 yields an asa configuration
  1062. @pytest.yield_fixture(scope='function')
  1063. def parse_a02(request):
  1064. """Preparsed a02"""
  1065. parse_a02_factory = CiscoConfParse(a02, syntax='asa', factory=False)
  1066. yield parse_a02_factory
  1067. ## parse_a02_factory yields an asa configuration
  1068. @pytest.yield_fixture(scope='function')
  1069. def parse_a02_factory(request):
  1070. """Preparsed a02 with factory option"""
  1071. parse_a02_factory = CiscoConfParse(a02, syntax='asa', factory=True)
  1072. yield parse_a02_factory
  1073. @pytest.mark.skipif(sys.version_info[0]>=3,
  1074. reason="No Python3 MockSSH support")
  1075. @pytest.mark.skipif('windows' in platform.system().lower(),
  1076. reason="No Windows MockSSH support")
  1077. @pytest.yield_fixture(scope='session')
  1078. def cisco_sshd_mocked(request):
  1079. """Mock Cisco IOS SSH"""
  1080. from fixtures.devices.mock_cisco import start_cisco_mock, stop_cisco_mock
  1081. try:
  1082. ## Start the SSH Server
  1083. start_cisco_mock()
  1084. yield True
  1085. except:
  1086. yield False
  1087. stop_cisco_mock()
  1088. stop_cisco_mock()