Comments (4)
Hi @songtianyi – the ANTLR4 grammars are compiled automatically as part of the build, using the antlr4-maven-plugin
.
from batfish.
@dhalperi
The compilation failed
cd projects/batfish/
mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building batfish 0.28.1
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.batfish:batfish-common-protocol:jar:0.28.1 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.689 s
[INFO] Finished at: 2017-07-11T16:04:21+08:00
[INFO] Final Memory: 8M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project batfish: Could not resolve dependencies for project org.batfish:batfish:jar:0.28.1: Failure to find org.batfish:batfish-common-protocol:jar:0.28.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
from batfish.
cd projects/
mvn compile
mvn install
cp /Users/work/.m2/repository/org/batfish/allinone/0.28.1/allinone-0.28.1.jar $MYPROJECT/lib
This would be fine.
I want to use batfish grammar in my own project. But It couldn't recognize all network objects, just one showed.
Demo.java
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.tree.*;
import java.io.File;
import java.io.FileInputStream;
import org.batfish.grammar.cisco.*;
public class Demo {
public static void main(String args[]) {
try {
File file = new File("/Users/work/dev/g4/cisco-host/test.txt");
// create a CharStream that reads from standard input
ANTLRInputStream input = new ANTLRInputStream(new FileInputStream(file)); // create a lexer that feeds off of input CharStream
CiscoLexer lexer = new CiscoLexer(input); // create a buffer of tokens pulled from the lexer
CommonTokenStream tokens = new CommonTokenStream(lexer); // create a parser that feeds off the tokens buffer
CiscoParser parser = new CiscoParser(tokens);
ParseTree tree = parser.s_object(); // begin parsing at init rule
ParseTreeWalker walker = new ParseTreeWalker();
walker.walk(new Loader(), tree);
}catch(Exception e) {
System.out.println(e.toString());
}
}
}
Loader.java
import org.batfish.grammar.cisco.CiscoParser;
import org.batfish.grammar.cisco.CiscoParserBaseListener;
import java.util.*;
/**
* Created by work on 2017/7/7.
*/
public class Loader extends CiscoParserBaseListener{
public void enterS_object(CiscoParser.S_objectContext ctx) {
System.out.println("new network object");
}
}
test.txt
object network haha
subnet 192.168.125.0 255.255.255.0
object network hasdfs
host 192.168.125.125
object network asdfa
range 192.168.125.2 192.168.125.124
object network asdfs
object network asdfas
range 192.168.125.2 192.168.125.124
object network range
object network range
object network range
object network range
object network range
object network heeh1
object network sd1
object network range
output
new network object
from batfish.
I wrote a new rule to solve this.
objects
:
(s_object)*
;
It works! Close!
from batfish.
Related Issues (20)
- Batfish giving different output than PAN FW GUI HOT 1
- Sophos Support HOT 2
- Batfish HOT 1
- SetAdministrativeCost should allow use of 32-bit integers. HOT 4
- filtering with internet community HOT 2
- Juniper prefix-list apply-paths and snmp client-lists aren't correctly parsed. HOT 3
- Can't Batfish analyze such EVPN configurations?Which Cisco series EVPN configuration network Batfish supports for analysis ? HOT 1
- Some errors parsing Fortigate configuration HOT 1
- Juniper apply-groups subtleties HOT 1
- Bugs in setting the ingress replication protocol HOT 1
- deactivate_interfaces throwing error while doing a bf.fork_snapshot HOT 2
- Arista EOS: evpn rib routes not in route table HOT 2
- Does Batfish support layer3 EVPN? HOT 1
- Routes learned with EIGRP cannot be redistributed to iBGP
- Routes learned with iBGP cannot be redistributed to EIGRP
- Symbolic Route Analysis: Handling of intermediate BGP attributes
- In the case of IOS, Batfish crashes when executing Bi-directional Reachability to the IP address after NAT. HOT 5
- In a configuration that includes an ASA, running Bi-direction reachability for an IP address that goes through the SNAT-configured ASA returns empty data. HOT 3
- Crash on Palo Alto with incomplete OSPF settings HOT 1
- When execution Bi-directional Reachability questions using TCP flags, data may not be obtained. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from batfish.