expect4java

Printer-friendly versionPDF version

Expect for java (expect4java) has been created in the context of the project netTransformer.
The benefit over the existing ExpectJ and Expect4J and Expect-for-Java projects is that it supports nested java closures.
The nested closures allow the developer to expect nested statements.

For example if you have a Router configuration with a running config with Interface statements like that one


interface GigabitEthernet0/0
 description $ETH-LAN$$ETH-SW-LAUNCH$$INTF-INFO-GE 0/0$
 ip address 10.10.10.1 255.255.255.248
 duplex auto
 speed auto
!         
interface GigabitEthernet0/0.17
 encapsulation dot1Q 17
 ip vrf forwarding man
 ip address 10.17.1.4 255.255.255.0
!

So in such case we would like to expect first that we have a GigabitEthernet Interface and then that its description is in the right format, the  ip address is in the specified range and and the duplex and the speed are set to auto.

Expect4java has been hosted in github https://github.com/iTransformers/expect4java and is distributed over maven central.