├── .gitignore
├── README.md
├── distribution
├── assembly
│ ├── bin.xml
│ └── filter.properties
└── pom.xml
├── modules
├── core
│ ├── datasource-mgt
│ │ ├── pom.xml
│ │ └── src
│ │ │ ├── main
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── mudie
│ │ │ │ │ └── datasource
│ │ │ │ │ ├── DataSourceFactory.java
│ │ │ │ │ └── internal
│ │ │ │ │ └── DatasourceSeerPluginImpl.java
│ │ │ └── resources
│ │ │ │ └── META-INF
│ │ │ │ └── services
│ │ │ │ └── com.mudie.common.SeerPlugin
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── mudie
│ │ │ └── framework
│ │ │ └── AppTest.java
│ ├── sdn-controller-mgt
│ │ ├── pom.xml
│ │ └── src
│ │ │ ├── main
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── mudie
│ │ │ │ │ └── sdn
│ │ │ │ │ └── controller
│ │ │ │ │ └── mgt
│ │ │ │ │ ├── HostInfo.java
│ │ │ │ │ ├── OFController.java
│ │ │ │ │ ├── exception
│ │ │ │ │ └── OFControllerException.java
│ │ │ │ │ ├── impl
│ │ │ │ │ ├── FaucetOFControllerImpl.java
│ │ │ │ │ ├── ModFlowMsg.java
│ │ │ │ │ ├── NatsClient.java
│ │ │ │ │ └── faucet
│ │ │ │ │ │ ├── Acls.java
│ │ │ │ │ │ ├── AclsIn.java
│ │ │ │ │ │ ├── Action.java
│ │ │ │ │ │ ├── Actions.java
│ │ │ │ │ │ ├── FaucetByteStatPoint.java
│ │ │ │ │ │ ├── FaucetPacketStatPoint.java
│ │ │ │ │ │ ├── L2Learn.java
│ │ │ │ │ │ ├── L2LearnWrapper.java
│ │ │ │ │ │ ├── Rule.java
│ │ │ │ │ │ ├── RuleWrapper.java
│ │ │ │ │ │ ├── Rules.java
│ │ │ │ │ │ └── SwitchFaucetConfig.java
│ │ │ │ │ └── internal
│ │ │ │ │ ├── SdnControllerDataHolder.java
│ │ │ │ │ └── SdnControllerSeerPluginImpl.java
│ │ │ └── resources
│ │ │ │ └── META-INF
│ │ │ │ └── services
│ │ │ │ ├── com.mudie.common.SeerPlugin
│ │ │ │ └── com.mudie.sdn.controller.mgt.OFController
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── mudie
│ │ │ └── framework
│ │ │ ├── NatsAddFlowPublisherTest.java
│ │ │ ├── NatsReloadTest.java
│ │ │ └── NatsSubscriberTest.java
│ ├── seer-common
│ │ ├── pom.xml
│ │ └── src
│ │ │ ├── main
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── mudie
│ │ │ │ └── common
│ │ │ │ ├── DeviceMudWrapper.java
│ │ │ │ ├── PriviledgedSeerContext.java
│ │ │ │ ├── SeerApiPlugin.java
│ │ │ │ ├── SeerDirectory.java
│ │ │ │ ├── SeerPlugin.java
│ │ │ │ ├── SeerUtil.java
│ │ │ │ ├── config
│ │ │ │ ├── Controller.java
│ │ │ │ ├── MUDController.java
│ │ │ │ ├── MudConfig.java
│ │ │ │ └── SeerConfiguration.java
│ │ │ │ ├── mud
│ │ │ │ ├── AccessControlList.java
│ │ │ │ ├── AccessControlListHolder.java
│ │ │ │ ├── AccessDTO.java
│ │ │ │ ├── AccessList.java
│ │ │ │ ├── AccessLists.java
│ │ │ │ ├── Ace.java
│ │ │ │ ├── Aces.java
│ │ │ │ ├── Actions.java
│ │ │ │ ├── EthMatch.java
│ │ │ │ ├── IPV4Match.java
│ │ │ │ ├── IPV6Match.java
│ │ │ │ ├── IcmpMatch.java
│ │ │ │ ├── IetfAccessControlListHolder.java
│ │ │ │ ├── IetfMud.java
│ │ │ │ ├── IetfMudMatch.java
│ │ │ │ ├── Match.java
│ │ │ │ ├── MudSpec.java
│ │ │ │ ├── PortMatch.java
│ │ │ │ ├── TcpMatch.java
│ │ │ │ └── UdpMatch.java
│ │ │ │ ├── openflow
│ │ │ │ ├── OFFlow.java
│ │ │ │ └── OFSwitch.java
│ │ │ │ ├── packet
│ │ │ │ ├── PacketConstants.java
│ │ │ │ ├── PacketListener.java
│ │ │ │ └── SeerPacket.java
│ │ │ │ └── stats
│ │ │ │ └── OFFlowStatsListener.java
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── mudie
│ │ │ └── framework
│ │ │ └── AppTest.java
│ ├── seer-framework
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── mudie
│ │ │ └── framework
│ │ │ ├── SeerCore.java
│ │ │ ├── api
│ │ │ └── SeerApiCore.java
│ │ │ ├── health
│ │ │ └── monitor
│ │ │ │ └── HealthRestApiController.java
│ │ │ └── shutdown
│ │ │ └── SeerShutdownHook.java
│ └── seer-mgt
│ │ ├── pom.xml
│ │ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── mudie
│ │ │ │ └── seer
│ │ │ │ └── mgt
│ │ │ │ ├── SeerMgtAdminRestApi.java
│ │ │ │ ├── SeerMgtRestApi.java
│ │ │ │ ├── dao
│ │ │ │ ├── DeviceDAO.java
│ │ │ │ ├── GroupDAO.java
│ │ │ │ ├── SeerManagementDAOFactory.java
│ │ │ │ ├── SwitchDAO.java
│ │ │ │ ├── exception
│ │ │ │ │ ├── IllegalTransactionStateException.java
│ │ │ │ │ └── TransactionManagementException.java
│ │ │ │ └── impl
│ │ │ │ │ ├── DeviceDAOImpl.java
│ │ │ │ │ ├── GroupDAOImpl.java
│ │ │ │ │ └── SwitchDAOImpl.java
│ │ │ │ ├── dto
│ │ │ │ ├── Device.java
│ │ │ │ ├── DeviceRecord.java
│ │ │ │ ├── Group.java
│ │ │ │ └── Switch.java
│ │ │ │ ├── exception
│ │ │ │ └── SeerManagementException.java
│ │ │ │ ├── internal
│ │ │ │ ├── SeerManagementDataHolder.java
│ │ │ │ └── SeerManagmentSeerPluginImpl.java
│ │ │ │ ├── service
│ │ │ │ ├── SeerMgtService.java
│ │ │ │ └── impl
│ │ │ │ │ └── SeerMgtServiceImpl.java
│ │ │ │ └── util
│ │ │ │ └── SeerManagementDAOUtil.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── services
│ │ │ ├── com.mudie.common.SeerApiPlugin
│ │ │ ├── com.mudie.common.SeerPlugin
│ │ │ └── com.mudie.seer.mgt.service.SeerMgtService
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── mudie
│ │ └── framework
│ │ └── AppTest.java
├── packet-processor
│ └── vxlan-listener
│ │ ├── pom.xml
│ │ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── mudie
│ │ │ │ └── vxlan
│ │ │ │ └── listener
│ │ │ │ ├── IncommingPacketHandler.java
│ │ │ │ ├── OsCheck.java
│ │ │ │ ├── VxlanListener.java
│ │ │ │ └── internal
│ │ │ │ ├── VxLanListenerDataHolder.java
│ │ │ │ └── VxlanListenerSeerPluginImpl.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── services
│ │ │ └── com.mudie.common.SeerPlugin
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── mudie
│ │ └── framework
│ │ └── AppTest.java
└── seer-apps
│ ├── mud-collector
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── mudie
│ │ │ │ └── mud
│ │ │ │ └── collector
│ │ │ │ ├── DeviceIdentifier.java
│ │ │ │ ├── MudieStatsCollector.java
│ │ │ │ ├── internal
│ │ │ │ ├── MUDCollectorDataHolder.java
│ │ │ │ └── MUDCollectorSeerPluginImpl.java
│ │ │ │ └── mudflowdto
│ │ │ │ ├── DeviceMUDFlowMap.java
│ │ │ │ └── MudFeatureWrapper.java
│ │ └── resources
│ │ │ └── META-INF
│ │ │ └── services
│ │ │ └── com.mudie.common.SeerPlugin
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── mudie
│ │ └── framework
│ │ └── AppTest.java
│ └── mud-processor
│ ├── pom.xml
│ └── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── mudie
│ │ │ └── mud
│ │ │ └── processor
│ │ │ ├── DeviceIdentifier.java
│ │ │ ├── DeviceMUDFlowMap.java
│ │ │ ├── MUDProcessorPacketListenerImpl.java
│ │ │ ├── dhcp
│ │ │ ├── BasePacket.java
│ │ │ ├── DHCP.java
│ │ │ ├── DHCPOption.java
│ │ │ ├── DHCPPacketType.java
│ │ │ ├── Data.java
│ │ │ ├── IPacket.java
│ │ │ └── PacketParsingException.java
│ │ │ ├── exception
│ │ │ └── MUDProcessorException.java
│ │ │ └── internal
│ │ │ ├── MUDProcesserDataHolder.java
│ │ │ └── MUDProcessorSeerPluginImpl.java
│ └── resources
│ │ └── META-INF
│ │ └── services
│ │ ├── com.mudie.common.SeerPlugin
│ │ └── com.mudie.common.packet.PacketListener
│ └── test
│ └── java
│ └── com
│ └── mudie
│ └── framework
│ └── AppTest.java
├── pom.xml
└── resources
├── bin
├── seer.sh
└── version.txt
├── conf
├── deployment.yml
└── mud-device-list.csv
├── datasources
└── seer-mgt.properties
├── dbscripts
└── seer-mgt
│ └── h2.sql
├── faucet
├── conf
│ ├── faucet.yaml
│ └── gauge.yaml
├── docker-compose.yaml
├── etc
│ ├── default
│ │ ├── faucet
│ │ └── gauge
│ ├── faucet
│ │ ├── acls.yaml
│ │ ├── aruba_pipeline.json
│ │ ├── faucet.yaml
│ │ ├── gauge.yaml
│ │ ├── ofproto_to_ryu.json
│ │ ├── ryu.conf
│ │ └── tfm_pipeline.json
│ ├── logrotate.d
│ │ ├── faucet
│ │ └── gauge
│ ├── prometheus
│ │ ├── faucet.rules.yml
│ │ ├── prometheus-docker-compose.yml
│ │ └── prometheus.yml
│ └── systemd
│ │ └── system
│ │ ├── faucet.service
│ │ ├── gauge.service
│ │ └── prometheus.service
├── extension
│ ├── Dockerfile
│ ├── nats_adapter.py
│ ├── nats_client.py
│ └── requirements.txt
└── ryu
│ ├── Dockerfile
│ ├── nats_adapter.py
│ ├── nats_client.py
│ └── requirements.txt
└── mud-collector
├── conf
└── deployment.yml
└── datasources
└── seer-mgt.properties
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 | dependency-reduced-pom.xml
3 |
4 | # Mobile Tools for Java (J2ME)
5 | .mtj.tmp/
6 |
7 | # Package Files #
8 | *.jar
9 | *.war
10 | *.ear
11 |
12 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
13 | hs_err_pid*
14 |
15 | *.class
16 |
17 | # Mobile Tools for Java (J2ME)
18 | .mtj.tmp/
19 |
20 | # Package Files #
21 | *.war
22 | *.ear
23 |
24 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
25 | hs_err_pid*
26 |
27 | # Ignore everything in this directory
28 | target
29 | .classpath
30 | .settings
31 | .project
32 | *.iml
33 | .idea
34 | .DS_Store
35 | *.pyc
36 | .sonar
37 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # mud-ie
2 | SDN based system to translate Manufacturer Usade Description(MUD) to flow rules using Faucet as a controller.
3 |
4 | # MUD
5 |
6 | This specification allows an operator to lock down the network traffic of the IoT device using access control lists (ACLs) derived from its MUD profile; This work used software defined networking (SDN) as a vehicle to translate MUD profiles into static and dynamic flow rules that can be applied at run-time on OpenFlow-capable switches to limit IoT traffic
7 |
8 | # Reference
9 | https://tools.ietf.org/html/draft-ietf-opsawg-mud-25
10 |
11 | # Prerequisite
12 | LibPcap (install tcpdump)
13 |
14 | # Installation
15 |
16 | ```sh
17 | $ git clone https://github.com/ayyoob/mud-ie.git
18 | $ cd mud-ie
19 | $ mvn clean install
20 | ```
21 |
22 | The product pack (zip file) will be available in distribution/target
23 | # Product execution
24 |
25 | This product contains of 3 seperate execution scripts
26 |
27 | ```sh
28 | 1) Ryu/Faucet/influx db/nats : execute the docker compose file by executing the command docker-compose up
29 | 2) inspector-engine: execute the seer.sh file in the bin directory
30 | 3) mud-collector: execute the seer.shh file in the bin director
31 | ```
32 |
33 | Before starting the setup it is essential to configure all the switches in faucet.yaml file, A sample file is provided in the faucet/conf directory.
34 |
35 |
36 |
--------------------------------------------------------------------------------
/distribution/assembly/filter.properties:
--------------------------------------------------------------------------------
1 | product.name=mudie
2 | product.key=Seer
3 | product.version=1.0.0-SNAPSHOT
4 | product.doc.version=1.0.0-SNAPSHOT
--------------------------------------------------------------------------------
/modules/core/datasource-mgt/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 |
6 | com.mudie
7 | product-seer
8 | 1.0.0-SNAPSHOT
9 | ../../../pom.xml
10 |
11 |
12 | datasource-mgt
13 | jar
14 |
15 | seer-common
16 | http://maven.apache.org
17 |
18 |
19 | UTF-8
20 |
21 |
22 |
23 |
24 | com.mudie
25 | seer-common
26 |
27 |
28 | junit
29 | junit
30 | 3.8.1
31 | test
32 |
33 |
34 | org.slf4j
35 | slf4j-api
36 |
37 |
38 | com.zaxxer
39 | HikariCP
40 |
41 |
42 | org.eclipse.jetty
43 | jetty-jndi
44 |
45 |
46 |
47 |
48 |
49 | org.apache.maven.plugins
50 | maven-jar-plugin
51 | 2.4
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/modules/core/datasource-mgt/src/main/java/com/mudie/datasource/DataSourceFactory.java:
--------------------------------------------------------------------------------
1 | package com.mudie.datasource;
2 |
3 | import com.mudie.common.SeerDirectory;
4 | import com.zaxxer.hikari.HikariConfig;
5 | import com.zaxxer.hikari.HikariDataSource;
6 | import org.slf4j.Logger;
7 | import org.slf4j.LoggerFactory;
8 |
9 | import javax.naming.Context;
10 | import javax.naming.InitialContext;
11 | import javax.naming.NameAlreadyBoundException;
12 | import javax.naming.NamingException;
13 | import javax.sql.DataSource;
14 | import java.io.*;
15 | import java.util.HashMap;
16 | import java.util.Map;
17 | import java.util.Properties;
18 |
19 | public class DataSourceFactory {
20 | private static final String JNDI_PROPERTY = "jndiName";
21 | private static Map dataSourceMap = new HashMap<>();
22 | private static final Logger log = LoggerFactory.getLogger(DataSourceFactory.class);
23 |
24 | private DataSourceFactory() { }
25 |
26 | public static void registerDatasources() {
27 | for (File file: getDatasourceFiles()) {
28 | Properties conf = new Properties();
29 | try {
30 | InputStream is = new FileInputStream(file);
31 | conf.load(is);
32 | String jndiName = conf.getProperty(JNDI_PROPERTY);
33 | if (jndiName != null && jndiName.length() > 0) {
34 | conf.remove(JNDI_PROPERTY);
35 | HikariConfig config = new HikariConfig(conf);
36 | DataSource dataSource = new HikariDataSource(config);
37 | Context context = new InitialContext();
38 | Context jdbcCtx;
39 | try {
40 | Context compCtx = (Context) context.lookup("java:comp");
41 | Context envCtx = compCtx.createSubcontext("env");
42 | jdbcCtx = envCtx.createSubcontext("jdbc");
43 | } catch (NameAlreadyBoundException e) {
44 | jdbcCtx = (Context) context.lookup("java:comp/env/jdbc");
45 | }
46 | jdbcCtx.bind(jndiName, dataSource);
47 | dataSourceMap.put(jndiName, dataSource);
48 | } else {
49 | log.error("JNDI name cannot be found for: " + file.getAbsolutePath());
50 | }
51 | } catch (IOException e) {
52 | log.error("Can't locate database configuration", e);
53 | } catch (NamingException e) {
54 | log.error("Failed to initialize jndi", e);
55 | }
56 | }
57 | }
58 |
59 | private static File[] getDatasourceFiles() {
60 | String datasourceDir = SeerDirectory.getDataSourceLocation();
61 | File datasourceFile = new File(datasourceDir);
62 | return datasourceFile.listFiles(new FilenameFilter() {
63 | public boolean accept(File dir, String name) {
64 | return name.toLowerCase().endsWith(".properties");
65 | }
66 | });
67 | }
68 |
69 | }
--------------------------------------------------------------------------------
/modules/core/datasource-mgt/src/main/java/com/mudie/datasource/internal/DatasourceSeerPluginImpl.java:
--------------------------------------------------------------------------------
1 | package com.mudie.datasource.internal;
2 |
3 | import com.mudie.common.SeerPlugin;
4 | import com.mudie.common.config.SeerConfiguration;
5 | import com.mudie.datasource.DataSourceFactory;
6 | import org.slf4j.Logger;
7 | import org.slf4j.LoggerFactory;
8 |
9 | import java.util.List;
10 |
11 | public class DatasourceSeerPluginImpl implements SeerPlugin {
12 |
13 | private static final Logger log = LoggerFactory.getLogger(DataSourceFactory.class);
14 |
15 | public DatasourceSeerPluginImpl() { };
16 |
17 | @Override
18 | public void activate(SeerConfiguration seerConfiguration) {
19 | DataSourceFactory.registerDatasources();
20 | log.debug("Datasource module is activated");
21 | }
22 |
23 | @Override
24 | public void deactivate() {
25 |
26 | }
27 |
28 | @Override
29 | public List getModuleDependencies() {
30 | return null;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/modules/core/datasource-mgt/src/main/resources/META-INF/services/com.mudie.common.SeerPlugin:
--------------------------------------------------------------------------------
1 | com.mudie.datasource.internal.DatasourceSeerPluginImpl
--------------------------------------------------------------------------------
/modules/core/datasource-mgt/src/test/java/com/mudie/framework/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.mudie.framework;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 |
6 | com.mudie
7 | product-seer
8 | 1.0.0-SNAPSHOT
9 | ../../../pom.xml
10 |
11 |
12 | sdn-controller-mgt
13 | jar
14 |
15 | sdn-controller-mgt
16 | http://maven.apache.org
17 |
18 |
19 | UTF-8
20 |
21 |
22 |
23 |
24 | com.mudie
25 | seer-common
26 |
27 |
28 | junit
29 | junit
30 | 3.8.1
31 | test
32 |
33 |
34 | org.slf4j
35 | slf4j-api
36 |
37 |
38 | io.github.openfeign
39 | feign-core
40 |
41 |
42 | io.github.openfeign
43 | feign-jaxrs
44 |
45 |
46 | io.github.openfeign
47 | feign-jackson
48 |
49 |
50 | io.github.openfeign
51 | feign-slf4j
52 |
53 |
54 | io.nats
55 | jnats
56 |
57 |
58 | org.influxdb
59 | influxdb-java
60 |
61 |
62 |
63 |
64 |
65 | org.apache.maven.plugins
66 | maven-jar-plugin
67 | 2.4
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/HostInfo.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt;
2 |
3 | public class HostInfo {
4 |
5 | private String dpId;
6 | private long portNo;
7 | private int vlanId;
8 |
9 | public String getDpId() {
10 | return dpId;
11 | }
12 |
13 | public void setDpId(String dpId) {
14 | this.dpId = dpId;
15 | }
16 |
17 | public long getPortNo() {
18 | return portNo;
19 | }
20 |
21 | public void setPortNo(long portNo) {
22 | this.portNo = portNo;
23 | }
24 |
25 | public int getVlanId() {
26 | return vlanId;
27 | }
28 |
29 | public void setVlanId(int vlanId) {
30 | this.vlanId = vlanId;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/OFController.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt;
2 |
3 | import com.mudie.common.openflow.OFFlow;
4 | import com.mudie.sdn.controller.mgt.exception.OFControllerException;
5 |
6 | import java.util.*;
7 |
8 | public interface OFController {
9 |
10 | void addFlow(String dpId, OFFlow ofFlow) throws OFControllerException;
11 |
12 | void addFlows(String dpId, List ofFlows) throws OFControllerException;
13 |
14 | void removeFlow(String dpId, OFFlow ofFlow) throws OFControllerException;
15 |
16 | void clearAllFlows(String dpId) throws OFControllerException;
17 |
18 | List getFlowStats(String dpId) throws OFControllerException;
19 |
20 | List getFilteredFlowStats(Object filter) throws OFControllerException;
21 |
22 | Map> getFlowStats() throws OFControllerException;
23 |
24 | void removeFlows(String dpId, List ofFlows) throws OFControllerException;
25 |
26 | void addACLs(String dpId, String deviceMac, List ofFlows, int vlan) throws OFControllerException;
27 |
28 | HostInfo getHostInfo(String device);
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/exception/OFControllerException.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.exception;
2 |
3 | public class OFControllerException extends Exception {
4 |
5 | public OFControllerException(Exception e) {
6 | super(e);
7 | }
8 |
9 | public OFControllerException(String msg) {
10 | super(msg);
11 | }
12 |
13 |
14 | public OFControllerException(String msg, Exception e) {
15 | super(msg, e);
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/impl/ModFlowMsg.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.impl;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 | import com.mudie.sdn.controller.mgt.impl.faucet.Action;
6 | import com.mudie.sdn.controller.mgt.impl.faucet.Rule;
7 |
8 | import java.util.List;
9 |
10 | @JsonInclude(JsonInclude.Include.NON_NULL)
11 | public class ModFlowMsg {
12 |
13 | private List actions;
14 | private long dpid;
15 | private int cookie;
16 | private int priority;
17 | private Rule match;
18 |
19 | @JsonProperty("idle_timeout")
20 | long idleTimeout;
21 |
22 | public long getDpid() {
23 | return dpid;
24 | }
25 |
26 | public void setDpid(long dpid) {
27 | this.dpid = dpid;
28 | }
29 |
30 | public int getCookie() {
31 | return cookie;
32 | }
33 |
34 | public void setCookie(int cookie) {
35 | this.cookie = cookie;
36 | }
37 |
38 | public int getPriority() {
39 | return priority;
40 | }
41 |
42 | public void setPriority(int priority) {
43 | this.priority = priority;
44 | }
45 |
46 | public Rule getMatch() {
47 | return match;
48 | }
49 |
50 | public void setMatch(Rule match) {
51 | this.match = match;
52 | }
53 |
54 | public List getActions() {
55 | return actions;
56 | }
57 |
58 | public void setActions(List actions) {
59 | this.actions = actions;
60 | }
61 |
62 | public long getIdleTimeout() {
63 | return idleTimeout;
64 | }
65 |
66 | public void setIdleTimeout(long idleTimeout) {
67 | this.idleTimeout = idleTimeout;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/impl/NatsClient.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.impl;
2 |
3 | import com.fasterxml.jackson.databind.ObjectMapper;
4 | import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
5 | import com.mudie.sdn.controller.mgt.internal.SdnControllerDataHolder;
6 | import com.mudie.sdn.controller.mgt.impl.faucet.L2LearnWrapper;
7 | import io.nats.client.Connection;
8 | import io.nats.client.Nats;
9 | import org.slf4j.Logger;
10 | import org.slf4j.LoggerFactory;
11 |
12 | import java.io.IOException;
13 |
14 | public class NatsClient implements Runnable {
15 | private String url;
16 | private static final String NATS_URL_PREFIX = "nats://";
17 | private static final String FAUCET_SOCKET_STREAM_SUBJECT = "faucet.sock.stream";
18 | private static final Logger log = LoggerFactory.getLogger(NatsClient.class);
19 | private static final int DEFAULT_RETRY_INTERVAL = 10000;
20 | private Connection subscriber;
21 | private static boolean disconnected = false;
22 | private static String L2_LEARN_LABLE = "L2_LEARN";
23 |
24 | public NatsClient() {
25 | url = NATS_URL_PREFIX + SdnControllerDataHolder.getController().getHostname() + ":" +
26 | SdnControllerDataHolder.getController().getPort();
27 |
28 | }
29 |
30 | public NatsClient(String url) {
31 | this.url = url;
32 |
33 | }
34 |
35 | private void connectAndSubscribe() throws IOException {
36 | subscriber = Nats.connect(url);
37 | subscriber.subscribe(FAUCET_SOCKET_STREAM_SUBJECT, m -> {
38 | String data = new String(m.getData());
39 | if (data.contains(L2_LEARN_LABLE)) {
40 | ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
41 | L2LearnWrapper l2LearnWrapper = null;
42 | try {
43 | l2LearnWrapper = mapper.readValue(data, L2LearnWrapper.class);
44 | SdnControllerDataHolder.getL2LearnWrapperMap().put(l2LearnWrapper.getL2Learn().getEthSrc(), l2LearnWrapper);
45 | } catch (IOException e) {
46 | log.error("invalid structure for l2 learn result" + data, e);
47 | }
48 | }
49 | });
50 | }
51 |
52 | public void publish(String subject, String msg) throws IOException {
53 | Connection publisher = Nats.connect(url);
54 | publisher.publish(subject, msg.getBytes());
55 | publisher.close();
56 | }
57 |
58 | public void disconnect() {
59 | disconnected = true;
60 | if (subscriber != null && !subscriber.isClosed()) {
61 | subscriber.close();
62 | }
63 | }
64 |
65 | @Override
66 | public void run() {
67 | while(!disconnected) {
68 | if (subscriber == null || !subscriber.isConnected()) {
69 | try {
70 | connectAndSubscribe();
71 | log.info("Nats Client connected");
72 | } catch (IOException e) {
73 | log.error("Failed to subscribe... retrying", e);
74 | try {
75 | Thread.sleep(DEFAULT_RETRY_INTERVAL);
76 | } catch (InterruptedException e1) {
77 | Thread.interrupted();
78 | }
79 | }
80 | }
81 | }
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/impl/faucet/Acls.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.impl.faucet;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 |
6 | public class Acls {
7 |
8 | private Map> acls;
9 |
10 | public Map> getAcls() {
11 | return acls;
12 | }
13 |
14 | public void setAcls(Map> acls) {
15 | this.acls = acls;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/impl/faucet/AclsIn.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.impl.faucet;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | import java.util.List;
6 |
7 | public class AclsIn {
8 |
9 | @JsonProperty("acls_in")
10 | private List aclsIn;
11 |
12 | public List getAclsIn() {
13 | return aclsIn;
14 | }
15 |
16 | public void setAclsIn(List aclsIn) {
17 | this.aclsIn = aclsIn;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/impl/faucet/Action.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.impl.faucet;
2 |
3 | public class Action {
4 | private String type;
5 | private long port;
6 |
7 | public String getType() {
8 | return type;
9 | }
10 |
11 | public void setType(String type) {
12 | this.type = type;
13 | }
14 |
15 |
16 | public long getPort() {
17 | return port;
18 | }
19 |
20 | public void setPort(long port) {
21 | this.port = port;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/impl/faucet/Actions.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.impl.faucet;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 |
5 | @JsonInclude(JsonInclude.Include.NON_NULL)
6 | public class Actions {
7 | private Integer allow;
8 | private Integer mirror;
9 |
10 | public Integer getAllow() {
11 | return allow;
12 | }
13 |
14 | public void setAllow(Integer allow) {
15 | this.allow = allow;
16 | }
17 |
18 | public Integer getMirror() {
19 | return mirror;
20 | }
21 |
22 | public void setMirror(Integer mirror) {
23 | this.mirror = mirror;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/impl/faucet/L2Learn.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.impl.faucet;
2 |
3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 |
6 | @JsonIgnoreProperties(ignoreUnknown=true)
7 | public class L2Learn {
8 | @JsonProperty("port_no")
9 | private long portNumber;
10 | @JsonProperty("vid")
11 | private int vlanId;
12 | @JsonProperty("eth_src")
13 | private String ethSrc;
14 |
15 | public long getPortNumber() {
16 | return portNumber;
17 | }
18 |
19 | public void setPortNumber(long portNumber) {
20 | this.portNumber = portNumber;
21 | }
22 |
23 | public int getVlanId() {
24 | return vlanId;
25 | }
26 |
27 | public void setVlanId(int vlanId) {
28 | this.vlanId = vlanId;
29 | }
30 |
31 | public String getEthSrc() {
32 | return ethSrc;
33 | }
34 |
35 | public void setEthSrc(String ethSrc) {
36 | this.ethSrc = ethSrc;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/impl/faucet/L2LearnWrapper.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.impl.faucet;
2 |
3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 |
6 | @JsonIgnoreProperties(ignoreUnknown=true)
7 | public class L2LearnWrapper {
8 |
9 | @JsonProperty("dp_id")
10 | private long dpId;
11 |
12 | @JsonProperty("L2_LEARN")
13 | private L2Learn l2Learn;
14 |
15 | public long getDpId() {
16 | return dpId;
17 | }
18 |
19 | public void setDpId(long dpId) {
20 | this.dpId = dpId;
21 | }
22 |
23 | public L2Learn getL2Learn() {
24 | return l2Learn;
25 | }
26 |
27 | public void setL2Learn(L2Learn l2Learn) {
28 | this.l2Learn = l2Learn;
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/impl/faucet/RuleWrapper.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.impl.faucet;
2 |
3 | public class RuleWrapper {
4 |
5 | private Rule rule;
6 |
7 | public Rule getRule() {
8 | return rule;
9 | }
10 |
11 | public void setRule(Rule rule) {
12 | this.rule = rule;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/impl/faucet/Rules.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.impl.faucet;
2 |
3 | import java.util.List;
4 |
5 | public class Rules {
6 |
7 |
8 | private List deviceRule;
9 |
10 | public List getDeviceRule() {
11 | return deviceRule;
12 | }
13 |
14 | public void setDeviceRule(List deviceRule) {
15 | this.deviceRule = deviceRule;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/impl/faucet/SwitchFaucetConfig.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.impl.faucet;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 |
6 | public class SwitchFaucetConfig {
7 |
8 | List include;
9 | Map vlans;
10 |
11 | public Map getVlans() {
12 | return vlans;
13 | }
14 |
15 | public void setVlans(Map vlans) {
16 | this.vlans = vlans;
17 | }
18 |
19 | public List getInclude() {
20 | return include;
21 | }
22 |
23 | public void setInclude(List include) {
24 | this.include = include;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/internal/SdnControllerDataHolder.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.internal;
2 |
3 | import com.mudie.common.config.Controller;
4 | import com.mudie.sdn.controller.mgt.impl.NatsClient;
5 | import com.mudie.sdn.controller.mgt.impl.faucet.L2LearnWrapper;
6 |
7 | import java.util.HashMap;
8 | import java.util.Map;
9 |
10 | public class SdnControllerDataHolder {
11 | private static Controller controller;
12 | private static NatsClient natsClient;
13 | private static Map l2LearnWrapperMap = new HashMap<>();
14 |
15 | public static Controller getController() {
16 | return controller;
17 | }
18 |
19 | public static void setController(Controller controller) {
20 | SdnControllerDataHolder.controller = controller;
21 | }
22 |
23 | public static NatsClient getNatsClient() {
24 | return natsClient;
25 | }
26 |
27 | public static void setNatsClient(NatsClient natsClient) {
28 | SdnControllerDataHolder.natsClient = natsClient;
29 | }
30 |
31 | public static Map getL2LearnWrapperMap() {
32 | return l2LearnWrapperMap;
33 | }
34 |
35 | public static void setL2LearnWrapperMap(Map l2LearnWrapperMap) {
36 | SdnControllerDataHolder.l2LearnWrapperMap = l2LearnWrapperMap;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/java/com/mudie/sdn/controller/mgt/internal/SdnControllerSeerPluginImpl.java:
--------------------------------------------------------------------------------
1 | package com.mudie.sdn.controller.mgt.internal;
2 |
3 | import com.mudie.common.SeerPlugin;
4 | import com.mudie.common.config.Controller;
5 | import com.mudie.common.config.SeerConfiguration;
6 | import com.mudie.sdn.controller.mgt.impl.NatsClient;
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 |
10 | import java.util.List;
11 |
12 | public class SdnControllerSeerPluginImpl implements SeerPlugin {
13 |
14 | private static final Logger log = LoggerFactory.getLogger(SdnControllerSeerPluginImpl.class);
15 |
16 | public SdnControllerSeerPluginImpl() { };
17 |
18 | @Override
19 | public void activate(SeerConfiguration seerConfiguration) {
20 | log.debug("SdnControllerSeerPlugin module is activated");
21 | Controller controller = seerConfiguration.getController();
22 | SdnControllerDataHolder.setController(controller);
23 |
24 | if (controller.getProperties() == null) {
25 | setupNATS();
26 | } else {
27 | String value = controller.getProperties().get("mode");
28 | if (value == null || value.length() == 0) {
29 | setupNATS();
30 | }
31 | }
32 | }
33 |
34 | private void setupNATS() {
35 | NatsClient natsClient = new NatsClient();
36 | SdnControllerDataHolder.setNatsClient(natsClient);
37 | Thread thread = new Thread(natsClient);
38 | thread.start();
39 | }
40 |
41 | @Override
42 | public void deactivate() {
43 | if (SdnControllerDataHolder.getController().getProperties() == null) {
44 | SdnControllerDataHolder.getNatsClient().disconnect();
45 | } else {
46 | String value = SdnControllerDataHolder.getController().getProperties().get("mode");
47 | if (value == null || value.length() == 0) {
48 | SdnControllerDataHolder.getNatsClient().disconnect();
49 | }
50 | }
51 |
52 | }
53 |
54 | @Override
55 | public List getModuleDependencies() {
56 | return null;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/resources/META-INF/services/com.mudie.common.SeerPlugin:
--------------------------------------------------------------------------------
1 | com.mudie.sdn.controller.mgt.internal.SdnControllerSeerPluginImpl
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/main/resources/META-INF/services/com.mudie.sdn.controller.mgt.OFController:
--------------------------------------------------------------------------------
1 | com.mudie.sdn.controller.mgt.impl.FaucetOFControllerImpl
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/test/java/com/mudie/framework/NatsAddFlowPublisherTest.java:
--------------------------------------------------------------------------------
1 | package com.mudie.framework;
2 |
3 | import com.fasterxml.jackson.databind.ObjectMapper;
4 | import com.mudie.common.openflow.OFFlow;
5 | import com.mudie.sdn.controller.mgt.impl.ModFlowMsg;
6 | import com.mudie.sdn.controller.mgt.impl.NatsClient;
7 | import com.mudie.sdn.controller.mgt.impl.faucet.Action;
8 | import com.mudie.sdn.controller.mgt.impl.faucet.Rule;
9 | import junit.framework.Test;
10 | import junit.framework.TestCase;
11 | import junit.framework.TestSuite;
12 |
13 | import java.io.IOException;
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | /**
18 | * Unit test for simple App.
19 | */
20 | public class NatsAddFlowPublisherTest
21 | extends TestCase
22 | {
23 | /**
24 | * Create the test case
25 | *
26 | * @param testName name of the test case
27 | */
28 | public NatsAddFlowPublisherTest(String testName )
29 | {
30 | super( testName );
31 | }
32 |
33 | /**
34 | * @return the suite of tests being tested
35 | */
36 | public static Test suite()
37 | {
38 | return new TestSuite( NatsAddFlowPublisherTest.class );
39 | }
40 |
41 | /**
42 | * Rigourous Test :-)
43 | */
44 | public void testApp()
45 | {
46 | assertTrue( true );
47 | }
48 |
49 | public static void main(String[] args) throws IOException, InterruptedException {
50 | NatsClient natsClient = new NatsClient("nats://149.171.37.71:4222");
51 | ModFlowMsg addFlowMsg = new ModFlowMsg();
52 | addFlowMsg.setDpid(Long.decode("0x"+"f4f26d229e7c"));
53 | Rule rule = new Rule();
54 | OFFlow ofFlow = new OFFlow();
55 | ofFlow.setSrcMac("ab:ff:ff:ff:ff:ff");
56 | ofFlow.setEthType("0x86dd");
57 | ofFlow.setIpProto("17");
58 | ofFlow.setDstPort("547");
59 | ofFlow.setDstIp("ff00::/8");
60 | ofFlow.setOfAction(OFFlow.OFAction.NORMAL);
61 | rule.setOFFlow(ofFlow);
62 | List actions = new ArrayList<>();
63 | if (ofFlow.getOfAction() == OFFlow.OFAction.NORMAL) {
64 | Action action = new Action();
65 | action.setType("OUTPUT");
66 | action.setPort(Long.decode("0xfffffffa"));
67 | actions.add(action);
68 | }
69 | addFlowMsg.setCookie(7730494);
70 | addFlowMsg.setPriority(15000);
71 | addFlowMsg.setIdleTimeout(60);
72 | addFlowMsg.setActions(actions);
73 | rule.setActions(null);
74 | List rules = new ArrayList<>();
75 | rules.add(rule);
76 | addFlowMsg.setMatch(rule);
77 | ObjectMapper mapper = new ObjectMapper();
78 | try {
79 | String msg = mapper.writeValueAsString(addFlowMsg);
80 | System.out.println(msg);
81 | natsClient.publish("faucet.msg", msg);
82 | } catch (IOException e) {
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/test/java/com/mudie/framework/NatsReloadTest.java:
--------------------------------------------------------------------------------
1 | package com.mudie.framework;
2 |
3 | import com.mudie.sdn.controller.mgt.impl.NatsClient;
4 | import junit.framework.Test;
5 | import junit.framework.TestCase;
6 | import junit.framework.TestSuite;
7 |
8 | import java.io.IOException;
9 |
10 | /**
11 | * Unit test for simple App.
12 | */
13 | public class NatsReloadTest
14 | extends TestCase
15 | {
16 | /**
17 | * Create the test case
18 | *
19 | * @param testName name of the test case
20 | */
21 | public NatsReloadTest(String testName )
22 | {
23 | super( testName );
24 | }
25 |
26 | /**
27 | * @return the suite of tests being tested
28 | */
29 | public static Test suite()
30 | {
31 | return new TestSuite( NatsReloadTest.class );
32 | }
33 |
34 | /**
35 | * Rigourous Test :-)
36 | */
37 | public void testApp()
38 | {
39 | assertTrue( true );
40 | }
41 |
42 | public static void main(String[] args) throws IOException {
43 | NatsClient natsClient = new NatsClient("nats://149.171.37.71:4222");
44 | natsClient.publish("faucet.msg", "reload");
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/modules/core/sdn-controller-mgt/src/test/java/com/mudie/framework/NatsSubscriberTest.java:
--------------------------------------------------------------------------------
1 | package com.mudie.framework;
2 |
3 | import com.mudie.sdn.controller.mgt.impl.NatsClient;
4 | import com.mudie.sdn.controller.mgt.internal.SdnControllerDataHolder;
5 |
6 | public class NatsSubscriberTest {
7 |
8 | public static void main(String[] args) throws InterruptedException {
9 | NatsClient natsClient = new NatsClient("nats://149.171.37.71:4222");
10 | SdnControllerDataHolder.setNatsClient(natsClient);
11 | Thread thread = new Thread(natsClient);
12 | thread.start();
13 | Thread.sleep(1000000L);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/modules/core/seer-common/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 |
6 | com.mudie
7 | product-seer
8 | 1.0.0-SNAPSHOT
9 | ../../../pom.xml
10 |
11 |
12 | seer-common
13 | jar
14 |
15 | seer-common
16 | http://maven.apache.org
17 |
18 |
19 | UTF-8
20 |
21 |
22 |
23 |
24 | junit
25 | junit
26 | 3.8.1
27 | test
28 |
29 |
30 | io.dropwizard
31 | dropwizard-core
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/DeviceMudWrapper.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common;
2 |
3 | public class DeviceMudWrapper {
4 |
5 | private String mudProfile;
6 | private int vlan;
7 | private static String SEPERATOR = "&@&";
8 |
9 | public DeviceMudWrapper() {
10 |
11 | }
12 |
13 | public DeviceMudWrapper(String payload) {
14 | String[] data = payload.split(SEPERATOR);
15 | mudProfile = data[0];
16 | vlan = Integer.parseInt(data[1]);
17 | }
18 |
19 | public String getMudProfile() {
20 | return mudProfile;
21 | }
22 |
23 | public void setMudProfile(String mudProfile) {
24 | this.mudProfile = mudProfile;
25 | }
26 |
27 | public int getVlan() {
28 | return vlan;
29 | }
30 |
31 | public void setVlan(int vlan) {
32 | this.vlan = vlan;
33 | }
34 |
35 | @Override
36 | public String toString() {
37 | return mudProfile + "&@&" + vlan + "&@&";
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/PriviledgedSeerContext.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common;
2 |
3 | import java.sql.Connection;
4 |
5 | public class PriviledgedSeerContext {
6 |
7 | private static ThreadLocal currentUser = new ThreadLocal();
8 |
9 | public static String getUserName() {
10 | String user = currentUser.get();
11 | if (user == null || user.isEmpty()) {
12 | throw new RuntimeException("User context is not set");
13 | }
14 | return currentUser.get();
15 | }
16 |
17 | public static void setCurrentUser(String user) {
18 | currentUser.set(user);
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/SeerApiPlugin.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common;
2 |
3 | public interface SeerApiPlugin {
4 | }
5 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/SeerDirectory.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common;
2 |
3 | public class SeerDirectory {
4 |
5 | private static final String SEER_HOME_DIR = "seer.home";
6 | private static final String SEER_CONFIG_DIR = "seer.config.dir.path";
7 | private static final String DATASOURCE_DIR = "seer.datasources.dir.path";
8 | private static final String LOG_DIR = "seer.logs.dir.path";
9 |
10 | public static String getDataSourceLocation() {
11 | return System.getProperty(DATASOURCE_DIR);
12 | }
13 |
14 | public static String getConfigDirectory() {
15 | return System.getProperty(SEER_CONFIG_DIR);
16 | }
17 |
18 | public static String getLogDirectory() {
19 | return System.getProperty(LOG_DIR);
20 | }
21 |
22 | public static String getRootDirectory() {
23 | return System.getProperty(SEER_HOME_DIR);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/SeerPlugin.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common;
2 |
3 | import com.mudie.common.config.SeerConfiguration;
4 |
5 | import java.util.List;
6 |
7 | public interface SeerPlugin {
8 |
9 | void activate(SeerConfiguration seerConfiguration);
10 |
11 | void deactivate();
12 |
13 | List getModuleDependencies();
14 | }
15 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/SeerUtil.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common;
2 |
3 | public class SeerUtil {
4 |
5 | public static String getSwitchMacFromDpID(String dpid) {
6 | //0xf4f26d229e7c
7 | String mac = dpid.substring(dpid.length() - 12);
8 | return String.join(":", mac.split("(?<=\\G.{2})"));
9 | }
10 |
11 | public static String getDpidFromMac(String mac) {
12 | String dpid = mac.replace(":", "");
13 | return dpid;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/config/Controller.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common.config;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import org.hibernate.validator.constraints.NotEmpty;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | public class Controller {
10 |
11 | @NotEmpty
12 | @JsonProperty
13 | private String hostname;
14 |
15 | @NotEmpty
16 | @JsonProperty
17 | private int port;
18 |
19 | @NotEmpty
20 | @JsonProperty
21 | private String type;
22 |
23 | Map properties;
24 |
25 | public String getHostname() {
26 | return hostname;
27 | }
28 |
29 | public void setHostname(String hostname) {
30 | this.hostname = hostname;
31 | }
32 |
33 | public int getPort() {
34 | return port;
35 | }
36 |
37 | public void setPort(int port) {
38 | this.port = port;
39 | }
40 |
41 | public String getType() {
42 | return type;
43 | }
44 |
45 | public void setType(String type) {
46 | this.type = type;
47 | }
48 |
49 | public Map getProperties() {
50 | return properties;
51 | }
52 |
53 | public void setProperties(Map properties) {
54 | this.properties = properties;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/config/MUDController.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common.config;
2 |
3 | public class MUDController {
4 |
5 | private String id;
6 | private String value;
7 |
8 | public String getId() {
9 | return id;
10 | }
11 |
12 | public void setId(String id) {
13 | this.id = id;
14 | }
15 |
16 | public String getValue() {
17 | return value;
18 | }
19 |
20 | public void setValue(String value) {
21 | this.value = value;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/config/MudConfig.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common.config;
2 |
3 | import java.util.List;
4 |
5 | public class MudConfig {
6 |
7 | private List mudControllers;
8 | private boolean mudPacketLogging;
9 | private int mudReactiveIdleTimeout;
10 | private int summerizationTimeInSeconds;
11 |
12 | public List getMudControllers() {
13 | return mudControllers;
14 | }
15 |
16 | public void setMudControllers(List mudControllers) {
17 | this.mudControllers = mudControllers;
18 | }
19 |
20 | public boolean isMudPacketLogging() {
21 | return mudPacketLogging;
22 | }
23 |
24 | public void setMudPacketLogging(boolean mudPacketLogging) {
25 | this.mudPacketLogging = mudPacketLogging;
26 | }
27 |
28 | public int getMudReactiveIdleTimeout() {
29 | return mudReactiveIdleTimeout;
30 | }
31 |
32 | public void setMudReactiveIdleTimeout(int mudReactiveIdleTimeout) {
33 | this.mudReactiveIdleTimeout = mudReactiveIdleTimeout;
34 | }
35 |
36 | public int getSummerizationTimeInSeconds() {
37 | return summerizationTimeInSeconds;
38 | }
39 |
40 | public void setSummerizationTimeInSeconds(int summerizationTimeInSeconds) {
41 | this.summerizationTimeInSeconds = summerizationTimeInSeconds;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/config/SeerConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common.config;
2 |
3 | import io.dropwizard.Configuration;
4 |
5 | import java.util.List;
6 |
7 | public class SeerConfiguration extends Configuration {
8 |
9 | private Controller controller;
10 | private String swagger;
11 | private List switches;
12 | private MudConfig mudConfig;
13 |
14 | public Controller getController() {
15 | return controller;
16 | }
17 |
18 | public void setController(Controller controller) {
19 | this.controller = controller;
20 | }
21 |
22 | public String getSwagger() {
23 | return swagger;
24 | }
25 |
26 | public void setSwagger(String swagger) {
27 | this.swagger = swagger;
28 | }
29 |
30 | public List getSwitches() {
31 | return switches;
32 | }
33 |
34 | public void setSwitches(List switches) {
35 | this.switches = switches;
36 | }
37 |
38 | public MudConfig getMudConfig() {
39 | return mudConfig;
40 | }
41 |
42 | public void setMudConfig(MudConfig mudConfig) {
43 | this.mudConfig = mudConfig;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/AccessControlList.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common.mud;
2 |
3 | public class AccessControlList {
4 |
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/AccessControlListHolder.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common.mud;
2 |
3 | public class AccessControlListHolder {
4 |
5 | private String name;
6 | private String type;
7 | private Aces aces;
8 |
9 | public String getName() {
10 | return name;
11 | }
12 |
13 | public void setName(String name) {
14 | this.name = name;
15 | }
16 |
17 | public String getType() {
18 | return type;
19 | }
20 |
21 | public void setType(String type) {
22 | this.type = type;
23 | }
24 |
25 | public Aces getAces() {
26 | return aces;
27 | }
28 |
29 | public void setAces(Aces aces) {
30 | this.aces = aces;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/AccessDTO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 |
19 | package com.mudie.common.mud;
20 |
21 | public class AccessDTO {
22 |
23 | private String name;
24 |
25 | public String getName() {
26 | return name;
27 | }
28 |
29 | public void setName(String name) {
30 | this.name = name;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/AccessList.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonProperty;
21 |
22 | import java.util.List;
23 |
24 | public class AccessList {
25 |
26 | @JsonProperty("access-list")
27 | private List accessDTOList;
28 |
29 | public List getAccessDTOList() {
30 | return accessDTOList;
31 | }
32 |
33 | public void setAccessDTOList(List accessDTOList) {
34 | this.accessDTOList = accessDTOList;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/AccessLists.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonProperty;
21 |
22 | public class AccessLists {
23 |
24 | @JsonProperty("access-lists")
25 | private AccessList accessList;
26 |
27 | public AccessList getAccessList() {
28 | return accessList;
29 | }
30 |
31 | public void setAccessList(AccessList accessList) {
32 | this.accessList = accessList;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/Ace.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | public class Ace {
21 |
22 | private String name;
23 | private Match matches;
24 | private Actions actions;
25 |
26 | public String getName() {
27 | return name;
28 | }
29 |
30 | public void setName(String name) {
31 | this.name = name;
32 | }
33 |
34 | public Match getMatches() {
35 | return matches;
36 | }
37 |
38 | public void setMatches(Match matches) {
39 | this.matches = matches;
40 | }
41 |
42 | public Actions getActions() {
43 | return actions;
44 | }
45 |
46 | public void setActions(Actions actions) {
47 | this.actions = actions;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/Aces.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonProperty;
21 |
22 | import java.util.List;
23 |
24 | public class Aces {
25 |
26 | @JsonProperty("ace")
27 | private List aceList;
28 |
29 | public List getAceList() {
30 | return aceList;
31 | }
32 |
33 | public void setAceList(List aceList) {
34 | this.aceList = aceList;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/Actions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | public class Actions {
21 |
22 | private String forwarding;
23 |
24 | public String getForwarding() {
25 | return forwarding;
26 | }
27 |
28 | public void setForwarding(String forwarding) {
29 | this.forwarding = forwarding;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/EthMatch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonInclude;
21 | import com.fasterxml.jackson.annotation.JsonProperty;
22 |
23 | @JsonInclude(JsonInclude.Include.NON_NULL)
24 | public class EthMatch {
25 |
26 | @JsonProperty("destination-mac-address")
27 | private String dstMacAddress;
28 |
29 | @JsonProperty("source-mac-address")
30 | private String srcMacAddress;
31 |
32 | @JsonProperty("ethertype")
33 | private String etherType;
34 |
35 | public String getDstMacAddress() {
36 | return dstMacAddress;
37 | }
38 |
39 | public void setDstMacAddress(String dstMacAddress) {
40 | this.dstMacAddress = dstMacAddress;
41 | }
42 |
43 | public String getSrcMacAddress() {
44 | return srcMacAddress;
45 | }
46 |
47 | public void setSrcMacAddress(String srcMacAddress) {
48 | this.srcMacAddress = srcMacAddress;
49 | }
50 |
51 | public String getEtherType() {
52 | return etherType;
53 | }
54 |
55 | public void setEtherType(String etherType) {
56 | this.etherType = etherType;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/IPV4Match.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonInclude;
21 | import com.fasterxml.jackson.annotation.JsonProperty;
22 |
23 | @JsonInclude(JsonInclude.Include.NON_NULL)
24 | public class IPV4Match {
25 |
26 | @JsonProperty("ietf-acldns:dst-dnsname")
27 | private String dstDnsName;
28 |
29 | @JsonProperty("ietf-acldns:src-dnsname")
30 | private String srcDnsName;
31 |
32 | private int protocol;
33 |
34 | @JsonProperty("destination-ipv4-network")
35 | private String destinationIp;
36 |
37 | @JsonProperty("source-ipv4-network")
38 | private String sourceIp;
39 |
40 | public String getDstDnsName() {
41 | return dstDnsName;
42 | }
43 |
44 | public void setDstDnsName(String dstDnsName) {
45 | this.dstDnsName = dstDnsName;
46 | }
47 |
48 | public String getSrcDnsName() {
49 | return srcDnsName;
50 | }
51 |
52 | public void setSrcDnsName(String srcDnsName) {
53 | this.srcDnsName = srcDnsName;
54 | }
55 |
56 | public int getProtocol() {
57 | return protocol;
58 | }
59 |
60 | public void setProtocol(int protocol) {
61 | this.protocol = protocol;
62 | }
63 |
64 | public String getDestinationIp() {
65 | return destinationIp;
66 | }
67 |
68 | public void setDestinationIp(String destinationIp) {
69 | this.destinationIp = destinationIp;
70 | }
71 |
72 | public String getSourceIp() {
73 | return sourceIp;
74 | }
75 |
76 | public void setSourceIp(String sourceIp) {
77 | this.sourceIp = sourceIp;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/IPV6Match.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonInclude;
21 | import com.fasterxml.jackson.annotation.JsonProperty;
22 |
23 | @JsonInclude(JsonInclude.Include.NON_NULL)
24 | public class IPV6Match {
25 |
26 | @JsonProperty("ietf-acldns:dst-dnsname")
27 | private String dstDnsName;
28 |
29 | @JsonProperty("ietf-acldns:src-dnsname")
30 | private String srcDnsName;
31 |
32 | private int protocol;
33 |
34 | @JsonProperty("destination-ipv6-network")
35 | private String destinationIp;
36 |
37 | @JsonProperty("source-ipv6-network")
38 | private String sourceIp;
39 |
40 | public String getDstDnsName() {
41 | return dstDnsName;
42 | }
43 |
44 | public void setDstDnsName(String dstDnsName) {
45 | this.dstDnsName = dstDnsName;
46 | }
47 |
48 | public String getSrcDnsName() {
49 | return srcDnsName;
50 | }
51 |
52 | public void setSrcDnsName(String srcDnsName) {
53 | this.srcDnsName = srcDnsName;
54 | }
55 |
56 | public int getProtocol() {
57 | return protocol;
58 | }
59 |
60 | public void setProtocol(int protocol) {
61 | this.protocol = protocol;
62 | }
63 |
64 | public String getDestinationIp() {
65 | return destinationIp;
66 | }
67 |
68 | public void setDestinationIp(String destinationIp) {
69 | this.destinationIp = destinationIp;
70 | }
71 |
72 | public String getSourceIp() {
73 | return sourceIp;
74 | }
75 |
76 | public void setSourceIp(String sourceIp) {
77 | this.sourceIp = sourceIp;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/IcmpMatch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonInclude;
21 | import com.fasterxml.jackson.annotation.JsonProperty;
22 |
23 | @JsonInclude(JsonInclude.Include.NON_NULL)
24 | public class IcmpMatch {
25 |
26 | @JsonProperty("type")
27 | private int type;
28 |
29 | @JsonProperty("code")
30 | private int code;
31 |
32 | public int getType() {
33 | return type;
34 | }
35 |
36 | public void setType(int type) {
37 | this.type = type;
38 | }
39 |
40 | public int getCode() {
41 | return code;
42 | }
43 |
44 | public void setCode(int code) {
45 | this.code = code;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/IetfAccessControlListHolder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonProperty;
21 |
22 | import java.util.List;
23 |
24 | public class IetfAccessControlListHolder {
25 |
26 | @JsonProperty("acl")
27 | private List accessControlListHolder;
28 |
29 | public List getAccessControlListHolder() {
30 | return accessControlListHolder;
31 | }
32 |
33 | public void setAccessControlListHolder(List accessControlListHolder) {
34 | this.accessControlListHolder = accessControlListHolder;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/IetfMud.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonInclude;
21 | import com.fasterxml.jackson.annotation.JsonProperty;
22 | import com.fasterxml.jackson.annotation.JsonPropertyOrder;
23 |
24 | @JsonInclude(JsonInclude.Include.NON_NULL)
25 | @JsonPropertyOrder({ "mud-version", "mud-url", "last-update", "cache-validity", "is-supported", "systeminfo", "from-device-policy", "to-device-policy" })
26 | public class IetfMud {
27 |
28 | @JsonProperty("mud-version")
29 | private int mudVersion;
30 |
31 | @JsonProperty("mud-url")
32 | private String mudUrl;
33 |
34 | @JsonProperty("last-update")
35 | private String lastUpdate;
36 |
37 | @JsonProperty("cache-validity")
38 | private int cacheValidity;
39 |
40 | @JsonProperty("is-supported")
41 | private boolean supported;
42 |
43 | @JsonProperty("systeminfo")
44 | private String systeminfo;
45 |
46 | @JsonProperty("from-device-policy")
47 | private AccessLists fromDevicePolicy;
48 |
49 | @JsonProperty("to-device-policy")
50 | private AccessLists toDevicePolicy;
51 |
52 | public int getMudVersion() {
53 | return mudVersion;
54 | }
55 |
56 | public void setMudVersion(int mudVersion) {
57 | this.mudVersion = mudVersion;
58 | }
59 |
60 | public String getMudUrl() {
61 | return mudUrl;
62 | }
63 |
64 | public void setMudUrl(String mudUrl) {
65 | this.mudUrl = mudUrl;
66 | }
67 |
68 | public String getLastUpdate() {
69 | return lastUpdate;
70 | }
71 |
72 | public void setLastUpdate(String lastUpdate) {
73 | this.lastUpdate = lastUpdate;
74 | }
75 |
76 | public int getCacheValidity() {
77 | return cacheValidity;
78 | }
79 |
80 | public void setCacheValidity(int cacheValidity) {
81 | this.cacheValidity = cacheValidity;
82 | }
83 |
84 | public boolean isSupported() {
85 | return supported;
86 | }
87 |
88 | public void setSupported(boolean supported) {
89 | this.supported = supported;
90 | }
91 |
92 | public String getSysteminfo() {
93 | return systeminfo;
94 | }
95 |
96 | public void setSysteminfo(String systeminfo) {
97 | this.systeminfo = systeminfo;
98 | }
99 |
100 | public AccessLists getFromDevicePolicy() {
101 | return fromDevicePolicy;
102 | }
103 |
104 | public void setFromDevicePolicy(AccessLists fromDevicePolicy) {
105 | this.fromDevicePolicy = fromDevicePolicy;
106 | }
107 |
108 | public AccessLists getToDevicePolicy() {
109 | return toDevicePolicy;
110 | }
111 |
112 | public void setToDevicePolicy(AccessLists toDevicePolicy) {
113 | this.toDevicePolicy = toDevicePolicy;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/IetfMudMatch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonInclude;
21 | import com.fasterxml.jackson.annotation.JsonProperty;
22 |
23 | import java.util.List;
24 |
25 | @JsonInclude(JsonInclude.Include.NON_NULL)
26 | public class IetfMudMatch {
27 |
28 | @JsonProperty("local-networks")
29 | private List localNetworks;
30 |
31 | private String controller;
32 |
33 | public String getController() {
34 | return controller;
35 | }
36 |
37 | public void setController(String controller) {
38 | this.controller = controller;
39 | }
40 |
41 | public List getLocalNetworks() {
42 | return localNetworks;
43 | }
44 |
45 | public void setLocalNetworks(List localNetworks) {
46 | this.localNetworks = localNetworks;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/Match.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonInclude;
21 | import com.fasterxml.jackson.annotation.JsonProperty;
22 |
23 | @JsonInclude(JsonInclude.Include.NON_NULL)
24 | public class Match {
25 |
26 | @JsonProperty("ietf-mud:mud")
27 | private IetfMudMatch ietfMudMatch;
28 |
29 | @JsonProperty("ipv4")
30 | private IPV4Match ipv4Match;
31 |
32 | @JsonProperty("ipv6")
33 | private IPV6Match ipv6Match;
34 |
35 | @JsonProperty("udp")
36 | private UdpMatch udpMatch;
37 |
38 | @JsonProperty("tcp")
39 | private TcpMatch tcpMatch;
40 |
41 | @JsonProperty("icmp")
42 | private IcmpMatch icmpMatch;
43 |
44 | @JsonProperty("eth")
45 | private EthMatch ethMatch;
46 |
47 | public UdpMatch getUdpMatch() {
48 | return udpMatch;
49 | }
50 |
51 | public void setUdpMatch(UdpMatch udpMatch) {
52 | this.udpMatch = udpMatch;
53 | }
54 |
55 | public TcpMatch getTcpMatch() {
56 | return tcpMatch;
57 | }
58 |
59 | public void setTcpMatch(TcpMatch tcpMatch) {
60 | this.tcpMatch = tcpMatch;
61 | }
62 |
63 | public IPV4Match getIpv4Match() {
64 | return ipv4Match;
65 | }
66 |
67 | public void setIpv4Match(IPV4Match ipv4Match) {
68 | this.ipv4Match = ipv4Match;
69 | }
70 |
71 | public IcmpMatch getIcmpMatch() {
72 | return icmpMatch;
73 | }
74 |
75 | public void setIcmpMatch(IcmpMatch icmpMatch) {
76 | this.icmpMatch = icmpMatch;
77 | }
78 |
79 | // @JsonProperty("l3")
80 | // private L3Match l3Match;
81 | //
82 | // @JsonProperty("l4")
83 | // private L4Match l4Match;
84 | //
85 | // public L3Match getL3Match() {
86 | // return l3Match;
87 | // }
88 | //
89 | // public void setL3Match(L3Match l3Match) {
90 | // this.l3Match = l3Match;
91 | // }
92 | //
93 | // public L4Match getL4Match() {
94 | // return l4Match;
95 | // }
96 | //
97 | // public void setL4Match(L4Match l4Match) {
98 | // this.l4Match = l4Match;
99 | // }
100 |
101 |
102 | public EthMatch getEthMatch() {
103 | return ethMatch;
104 | }
105 |
106 | public void setEthMatch(EthMatch ethMatch) {
107 | this.ethMatch = ethMatch;
108 | }
109 |
110 | public IPV6Match getIpv6Match() {
111 | return ipv6Match;
112 | }
113 |
114 | public void setIpv6Match(IPV6Match ipv6Match) {
115 | this.ipv6Match = ipv6Match;
116 | }
117 |
118 | public IetfMudMatch getIetfMudMatch() {
119 | return ietfMudMatch;
120 | }
121 |
122 | public void setIetfMudMatch(IetfMudMatch ietfMudMatch) {
123 | this.ietfMudMatch = ietfMudMatch;
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/MudSpec.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonProperty;
21 |
22 | public class MudSpec {
23 |
24 | @JsonProperty("ietf-mud:mud")
25 | private IetfMud ietfMud;
26 |
27 | @JsonProperty("ietf-access-control-list:access-lists")
28 | private IetfAccessControlListHolder accessControlList;
29 |
30 | public IetfMud getIetfMud() {
31 | return ietfMud;
32 | }
33 |
34 | public void setIetfMud(IetfMud ietfMud) {
35 | this.ietfMud = ietfMud;
36 | }
37 |
38 | public IetfAccessControlListHolder getAccessControlList() {
39 | return accessControlList;
40 | }
41 |
42 | public void setAccessControlList(IetfAccessControlListHolder accessControlList) {
43 | this.accessControlList = accessControlList;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/PortMatch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 | public class PortMatch {
20 | private String operator;
21 | private int port;
22 |
23 | public String getOperator() {
24 | return operator;
25 | }
26 |
27 | public void setOperator(String operator) {
28 | this.operator = operator;
29 | }
30 |
31 | public int getPort() {
32 | return port;
33 | }
34 |
35 | public void setPort(int port) {
36 | this.port = port;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/TcpMatch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonInclude;
21 | import com.fasterxml.jackson.annotation.JsonProperty;
22 |
23 | @JsonInclude(JsonInclude.Include.NON_NULL)
24 | public class TcpMatch {
25 |
26 | @JsonProperty("destination-port")
27 | private PortMatch destinationPortMatch;
28 |
29 | @JsonProperty("ietf-mud:direction-initiated")
30 | private String directionInitialized;
31 |
32 | @JsonProperty("source-port")
33 | private PortMatch sourcePortMatch;
34 |
35 | public PortMatch getDestinationPortMatch() {
36 | return destinationPortMatch;
37 | }
38 |
39 | public void setDestinationPortMatch(PortMatch destinationPortMatch) {
40 | this.destinationPortMatch = destinationPortMatch;
41 | }
42 |
43 | public PortMatch getSourcePortMatch() {
44 | return sourcePortMatch;
45 | }
46 |
47 | public void setSourcePortMatch(PortMatch sourcePortMatch) {
48 | this.sourcePortMatch = sourcePortMatch;
49 | }
50 |
51 | public String getDirectionInitialized() {
52 | return directionInitialized;
53 | }
54 |
55 | public void setDirectionInitialized(String directionInitialized) {
56 | this.directionInitialized = directionInitialized;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/mud/UdpMatch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018, UNSW. (https://www.unsw.edu.au/) All Rights Reserved.
3 | *
4 | * UNSW. licenses this file to you under the Apache License,
5 | * Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing,
12 | * software distributed under the License is distributed on an
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | * KIND, either express or implied. See the License for the
15 | * specific language governing permissions and limitations
16 | * under the License.
17 | */
18 | package com.mudie.common.mud;
19 |
20 | import com.fasterxml.jackson.annotation.JsonInclude;
21 | import com.fasterxml.jackson.annotation.JsonProperty;
22 |
23 | @JsonInclude(JsonInclude.Include.NON_NULL)
24 | public class UdpMatch {
25 |
26 | @JsonProperty("destination-port")
27 | private PortMatch destinationPortMatch;
28 |
29 | @JsonProperty("source-port")
30 | private PortMatch sourcePortMatch;
31 |
32 | public PortMatch getDestinationPortMatch() {
33 | return destinationPortMatch;
34 | }
35 |
36 | public void setDestinationPortMatch(PortMatch destinationPortMatch) {
37 | this.destinationPortMatch = destinationPortMatch;
38 | }
39 |
40 | public PortMatch getSourcePortMatch() {
41 | return sourcePortMatch;
42 | }
43 |
44 | public void setSourcePortMatch(PortMatch sourcePortMatch) {
45 | this.sourcePortMatch = sourcePortMatch;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/openflow/OFSwitch.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common.openflow;
2 |
3 |
4 | import java.util.ArrayList;
5 | import java.util.LinkedList;
6 | import java.util.List;
7 |
8 | public class OFSwitch {
9 |
10 | private String macAddress;
11 | private String ip;
12 | private String dpid;
13 | private long connectedTimestamp;
14 | private LinkedList ofFlows = new LinkedList();
15 | private List hosts = new ArrayList<>();
16 |
17 | public long getConnectedTimestamp() {
18 | return connectedTimestamp;
19 | }
20 |
21 | public void setConnectedTimestamp(long connectedTimestamp) {
22 | this.connectedTimestamp = connectedTimestamp;
23 | }
24 |
25 | public LinkedList getOfFlows() {
26 | return ofFlows;
27 | }
28 |
29 | public void setOfFlows(LinkedList ofFlows) {
30 | this.ofFlows = ofFlows;
31 | }
32 |
33 | public List getHosts() {
34 | return hosts;
35 | }
36 |
37 | public void setHosts(List hosts) {
38 | this.hosts = hosts;
39 | }
40 |
41 | public String getMacAddress() {
42 | return macAddress;
43 | }
44 |
45 | public void setMacAddress(String macAddress) {
46 | this.macAddress = macAddress;
47 | }
48 |
49 | public String getIp() {
50 | return ip;
51 | }
52 |
53 | public void setIp(String ip) {
54 | this.ip = ip;
55 | }
56 |
57 | public String getDpid() {
58 | return dpid;
59 | }
60 |
61 | public void setDpid(String dpid) {
62 | this.dpid = dpid;
63 | }
64 |
65 | public List getAllFlows() {
66 | return ofFlows;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/packet/PacketConstants.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common.packet;
2 |
3 | public class PacketConstants {
4 | public static final String IPV4_PROTO = "IPv4";
5 | public static final String ARP_PROTO = "ARP";
6 | public static final String TCP_PROTO ="6";
7 | public static final String UDP_PROTO ="17";
8 | public static final String DNS_PORT ="53";
9 | public static final String DHCP_PORT ="67";
10 | public static final String ICMP_PROTO = "1";
11 | public static final String ETH_TYPE_IPV4 = "0x0800";
12 | public static final String ETH_TYPE_IPV6 = "0x86dd";
13 | public static final String ETH_TYPE_ARP = "0x0806";
14 | public static final String NTP_PORT = "123";
15 | public static final String BROADCAST_ADDR ="ff:ff:ff:ff:ff:ff";
16 | public static final Long BROADCAST_DECIMAL = 281474976710655L;
17 | public static final Long MULTICAST_MULTIPLIER = 1099511627776L;
18 | public static final String LINK_LOCAL_MULTICAST_IP_RANGE = "ff00::/8";
19 | }
20 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/packet/PacketListener.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common.packet;
2 |
3 | public interface PacketListener {
4 |
5 | void processPacket(SeerPacket seerPacket);
6 | }
7 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/packet/SeerPacket.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common.packet;
2 |
3 | public class SeerPacket {
4 |
5 | private String vxlanId;
6 | private String srcMac;
7 | private String dstMac;
8 | private String ethType;
9 | private String srcIp;
10 | private String dstIp;
11 | private String ipProto;
12 | private String srcPort;
13 | private String dstPort;
14 | private int size;
15 | private byte[] payload;
16 |
17 | public void setTcpFlag(Flag tcpFlag) {
18 | this.tcpFlag = tcpFlag;
19 | }
20 |
21 | private Flag tcpFlag;
22 |
23 | public enum Flag {
24 | SYN,
25 | SYN_ACK,
26 | OTHER
27 | }
28 |
29 | public Flag getTcpFlag() {
30 | return tcpFlag;
31 | }
32 |
33 | public void setTcpFlag(boolean syn, boolean ack) {
34 | tcpFlag = Flag.OTHER;
35 | if (syn) {
36 | tcpFlag = Flag.SYN;
37 | if (ack) {
38 | tcpFlag = Flag.SYN_ACK;
39 | }
40 | }
41 | }
42 |
43 | public String getVxlanId() {
44 | return vxlanId;
45 | }
46 |
47 | public void setVxlanId(String vxlanId) {
48 | this.vxlanId = vxlanId;
49 | }
50 |
51 | public String getSrcMac() {
52 | return srcMac;
53 | }
54 |
55 | public void setSrcMac(String srcMac) {
56 | this.srcMac = srcMac;
57 | }
58 |
59 | public String getDstMac() {
60 | return dstMac;
61 | }
62 |
63 | public void setDstMac(String dstMac) {
64 | this.dstMac = dstMac;
65 | }
66 |
67 | public String getEthType() {
68 | return ethType;
69 | }
70 |
71 | public void setEthType(String ethType) {
72 | this.ethType = ethType;
73 | }
74 |
75 | public String getSrcIp() {
76 | return srcIp;
77 | }
78 |
79 | public void setSrcIp(String srcIp) {
80 | this.srcIp = srcIp;
81 | }
82 |
83 | public String getDstIp() {
84 | return dstIp;
85 | }
86 |
87 | public void setDstIp(String dstIp) {
88 | this.dstIp = dstIp;
89 | }
90 |
91 | public String getIpProto() {
92 | return ipProto;
93 | }
94 |
95 | public void setIpProto(String ipProto) {
96 | this.ipProto = ipProto;
97 | }
98 |
99 | public String getSrcPort() {
100 | return srcPort;
101 | }
102 |
103 | public void setSrcPort(String srcPort) {
104 | this.srcPort = srcPort;
105 | }
106 |
107 | public String getDstPort() {
108 | return dstPort;
109 | }
110 |
111 | public void setDstPort(String dstPort) {
112 | this.dstPort = dstPort;
113 | }
114 |
115 | public byte[] getPayload() {
116 | return payload;
117 | }
118 |
119 | public void setPayload(byte[] payload) {
120 | this.payload = payload;
121 | }
122 |
123 | public int getSize() {
124 | return size;
125 | }
126 |
127 | public void setSize(int size) {
128 | this.size = size;
129 | }
130 |
131 | public String getPacketInfo() {
132 | return System.currentTimeMillis() + ","+ srcMac + "," + dstMac + "," + ethType + "," + srcIp + "," + dstIp
133 | + "," + ipProto + "," + srcPort + "," + dstPort + "," + size ;
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/main/java/com/mudie/common/stats/OFFlowStatsListener.java:
--------------------------------------------------------------------------------
1 | package com.mudie.common.stats;
2 |
3 | import com.mudie.common.openflow.OFFlow;
4 |
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | public interface OFFlowStatsListener {
9 |
10 | /**
11 | * Key is the dpId, this is mapped with flowStats
12 | * @param ofFlowStats
13 | */
14 | void processFlowStats(Map> ofFlowStats);
15 | }
16 |
--------------------------------------------------------------------------------
/modules/core/seer-common/src/test/java/com/mudie/framework/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.mudie.framework;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/modules/core/seer-framework/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 |
6 | com.mudie
7 | product-seer
8 | 1.0.0-SNAPSHOT
9 | ../../../pom.xml
10 |
11 |
12 | seer-core
13 | jar
14 |
15 | seer-core
16 | http://maven.apache.org
17 |
18 |
19 | UTF-8
20 |
21 |
22 |
23 |
24 | org.slf4j
25 | slf4j-api
26 |
27 |
28 | com.mudie
29 | seer-common
30 |
31 |
32 | io.dropwizard
33 | dropwizard-core
34 |
35 |
36 | com.h2database
37 | h2
38 |
39 |
40 | io.swagger
41 | swagger-jersey2-jaxrs
42 |
43 |
44 |
45 |
46 |
47 |
48 | org.apache.maven.plugins
49 | maven-jar-plugin
50 |
51 |
52 |
53 |
54 | com.mudie.framework.SeerCore
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/modules/core/seer-framework/src/main/java/com/mudie/framework/api/SeerApiCore.java:
--------------------------------------------------------------------------------
1 | package com.mudie.framework.api;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import com.mudie.framework.health.monitor.HealthRestApiController;
5 | import com.mudie.common.SeerApiPlugin;
6 | import com.mudie.common.config.SeerConfiguration;
7 | import com.mudie.framework.SeerCore;
8 | import io.dropwizard.Application;
9 | import io.dropwizard.lifecycle.ServerLifecycleListener;
10 | import io.dropwizard.setup.Environment;
11 | import io.swagger.jaxrs.config.BeanConfig;
12 | import io.swagger.jaxrs.listing.ApiListingResource;
13 | import org.eclipse.jetty.server.Connector;
14 | import org.eclipse.jetty.server.Server;
15 | import org.eclipse.jetty.server.ServerConnector;
16 | import org.slf4j.Logger;
17 | import org.slf4j.LoggerFactory;
18 |
19 | import java.util.Iterator;
20 | import java.util.ServiceLoader;
21 |
22 | public class SeerApiCore extends Application {
23 |
24 | private static final Logger log = LoggerFactory.getLogger(SeerApiCore.class);
25 |
26 | @Override
27 | public void run(SeerConfiguration configuration, Environment environment) throws Exception {
28 | SeerCore.activatePlugin(configuration);
29 | log.info("Deploying services...");
30 | environment.jersey().register(new ApiListingResource());
31 | environment.jersey().register(new HealthRestApiController());
32 | environment.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
33 | ServiceLoader loader = ServiceLoader.load(SeerApiPlugin.class);
34 | Iterator it = loader.iterator();
35 | while (it.hasNext()) {
36 | SeerApiPlugin seerApi = it.next();
37 | environment.jersey().register(seerApi);
38 | }
39 | BeanConfig config = new BeanConfig();
40 | config.setTitle("Seer");
41 | config.setVersion("1.0.0");
42 | config.setResourcePackage("com.mudie");
43 | config.setScan(true);
44 |
45 |
46 | environment.lifecycle().addServerLifecycleListener(new ServerLifecycleListener() {
47 | @Override
48 | public void serverStarted(Server server) {
49 | for (Connector connector : server.getConnectors()) {
50 | if (connector instanceof ServerConnector) {
51 | ServerConnector serverConnector = (ServerConnector) connector;
52 | log.info(serverConnector.getName() +" services are deployed:"
53 | + serverConnector.getProtocols().get(0)
54 | .replace("/1.1", "").toLowerCase()
55 | + "://localhost:" + serverConnector.getLocalPort());
56 | log.info(serverConnector.getName() +" service definition can be found in:"
57 | + serverConnector.getProtocols().get(0)
58 | .replace("/1.1", "").toLowerCase()
59 | + "://localhost:" + serverConnector.getLocalPort() +"/swagger.yaml");
60 | }
61 | }
62 | }
63 | });
64 |
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/modules/core/seer-framework/src/main/java/com/mudie/framework/health/monitor/HealthRestApiController.java:
--------------------------------------------------------------------------------
1 | package com.mudie.framework.health.monitor;
2 |
3 | import io.swagger.annotations.Api;
4 | import io.swagger.annotations.ApiResponse;
5 | import io.swagger.annotations.ApiResponses;
6 |
7 | import javax.ws.rs.GET;
8 | import javax.ws.rs.Path;
9 | import javax.ws.rs.Produces;
10 | import javax.ws.rs.core.MediaType;
11 | import javax.ws.rs.core.Response;
12 |
13 | @Path("/health")
14 | @Produces(MediaType.APPLICATION_JSON)
15 | @Api(value = "/health", description = "Health test for services")
16 | public class HealthRestApiController {
17 |
18 | @GET
19 | @ApiResponses(value = { @ApiResponse(code = 200, message = "server is running")})
20 | public Response health() {
21 | return Response.ok().entity(true).build();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/modules/core/seer-framework/src/main/java/com/mudie/framework/shutdown/SeerShutdownHook.java:
--------------------------------------------------------------------------------
1 | package com.mudie.framework.shutdown;
2 |
3 | import com.mudie.common.SeerPlugin;
4 | import com.mudie.framework.SeerCore;
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 |
8 | import java.util.List;
9 | import java.util.Map;
10 |
11 | public class SeerShutdownHook extends Thread {
12 | private static final Logger log = LoggerFactory.getLogger(SeerShutdownHook.class);
13 | @Override
14 | public void run(){
15 | log.info("Server is shutting down.");
16 | deactivateModules();
17 | }
18 |
19 | private void deactivateModules() {
20 | Map activatedSeerModules = SeerCore.getActivatedSeerPlugin();
21 | List seerModules = SeerCore.getSeerPlugins();
22 | for (SeerPlugin seerModule: seerModules) {
23 | if (activatedSeerModules.get(seerModule.getClass().getCanonicalName()) != null) {
24 | try {
25 | seerModule.deactivate();
26 | } catch (Exception e) {
27 | log.error("Deactivation error", e);
28 | }
29 | }
30 | }
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 |
6 | com.mudie
7 | product-seer
8 | 1.0.0-SNAPSHOT
9 | ../../../pom.xml
10 |
11 |
12 | seer-mgt
13 | jar
14 |
15 | seer-mgt
16 | http://maven.apache.org
17 |
18 |
19 | UTF-8
20 |
21 |
22 |
23 |
24 | com.mudie
25 | seer-common
26 |
27 |
28 | junit
29 | junit
30 | 3.8.1
31 | test
32 |
33 |
34 | org.slf4j
35 | slf4j-api
36 |
37 |
38 | io.swagger
39 | swagger-jersey2-jaxrs
40 |
41 |
42 | io.swagger
43 | swagger-annotations
44 |
45 |
46 |
47 |
48 |
49 | org.apache.maven.plugins
50 | maven-jar-plugin
51 | 2.4
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/SeerMgtAdminRestApi.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt;
2 |
3 | import com.mudie.common.SeerApiPlugin;
4 | import com.mudie.seer.mgt.internal.SeerManagementDataHolder;
5 | import com.mudie.seer.mgt.dto.Switch;
6 | import com.mudie.seer.mgt.exception.SeerManagementException;
7 | import com.mudie.seer.mgt.service.SeerMgtService;
8 | import io.swagger.annotations.Api;
9 | import io.swagger.annotations.ApiResponse;
10 | import io.swagger.annotations.ApiResponses;
11 | import org.slf4j.Logger;
12 | import org.slf4j.LoggerFactory;
13 |
14 | import javax.ws.rs.POST;
15 | import javax.ws.rs.Path;
16 | import javax.ws.rs.Produces;
17 | import javax.ws.rs.core.MediaType;
18 | import javax.ws.rs.core.Response;
19 |
20 | @Path("/admin/seer/")
21 | @Produces(MediaType.APPLICATION_JSON)
22 | @Api(value = "/admin/seer", description = "seer mgt services")
23 | public class SeerMgtAdminRestApi implements SeerApiPlugin {
24 |
25 | private static final Logger log = LoggerFactory.getLogger(SeerMgtAdminRestApi.class);
26 |
27 | @POST
28 | @Path("/switch")
29 | @ApiResponses(value = { @ApiResponse(code = 200, message = "switch added.")})
30 | public Response addSwitch(Switch aswitch) {
31 | try {
32 | SeerMgtService seerMgtService = SeerManagementDataHolder.getSeerMgtService();
33 | int status = seerMgtService.addSwitch(aswitch);
34 | return Response.ok().entity(true).build();
35 | } catch (SeerManagementException e) {
36 | log.error(e.getMessage(), e);
37 | return Response.serverError().entity("Failed to add the switch").build();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/SeerMgtRestApi.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt;
2 |
3 | import com.mudie.common.PriviledgedSeerContext;
4 | import com.mudie.common.SeerApiPlugin;
5 | import com.mudie.seer.mgt.internal.SeerManagementDataHolder;
6 | import com.mudie.seer.mgt.dto.Device;
7 | import com.mudie.seer.mgt.dto.Switch;
8 | import com.mudie.seer.mgt.exception.SeerManagementException;
9 | import com.mudie.seer.mgt.service.SeerMgtService;
10 | import io.swagger.annotations.Api;
11 | import io.swagger.annotations.ApiOperation;
12 | import io.swagger.annotations.ApiResponse;
13 | import io.swagger.annotations.ApiResponses;
14 | import org.slf4j.Logger;
15 | import org.slf4j.LoggerFactory;
16 |
17 | import javax.ws.rs.GET;
18 | import javax.ws.rs.Path;
19 | import javax.ws.rs.PathParam;
20 | import javax.ws.rs.Produces;
21 | import javax.ws.rs.core.MediaType;
22 | import javax.ws.rs.core.Response;
23 | import java.util.List;
24 |
25 | @Path("/seer/")
26 | @Produces(MediaType.APPLICATION_JSON)
27 | @Api(value = "/seer", description = "seer mgt services")
28 | public class SeerMgtRestApi implements SeerApiPlugin {
29 |
30 | private static final Logger log = LoggerFactory.getLogger(SeerMgtRestApi.class);
31 |
32 | @GET
33 | @Path("/switches")
34 | @ApiOperation(
35 | value = "switch details",
36 | notes = "Returns switch details",
37 | response = List.class)
38 | @ApiResponses(value = { @ApiResponse(code = 200, message = "return switch details")})
39 | public Response getSwitches() {
40 | try {
41 | SeerMgtService seerMgtService = SeerManagementDataHolder.getSeerMgtService();
42 | List aswitchs = seerMgtService.getSwitches(PriviledgedSeerContext.getUserName());
43 | return Response.ok().entity(aswitchs).build();
44 |
45 | } catch (SeerManagementException e) {
46 | log.error(e.getMessage(), e);
47 | return Response.serverError().entity("login service is temporarily unavailable, try again later").build();
48 | }
49 | }
50 |
51 | @GET
52 | @Path("/switch/{dpId}/devices")
53 | @ApiOperation(
54 | value = "device details",
55 | notes = "Returns device details",
56 | response = List.class)
57 | @ApiResponses(value = { @ApiResponse(code = 200, message = "return device details")})
58 | public Response getDevices(@PathParam("dpId") String dpId) {
59 | try {
60 | SeerMgtService seerMgtService = SeerManagementDataHolder.getSeerMgtService();
61 | Switch aswitch = seerMgtService.getSwitch(dpId);
62 | if (aswitch != null) {
63 | if (aswitch.getOwner().equals(PriviledgedSeerContext.getUserName())) {
64 | List users = seerMgtService.getDevices(dpId);
65 | return Response.ok().entity(users).build();
66 | }
67 | return Response.status(Response.Status.UNAUTHORIZED).build();
68 | }
69 | return Response.noContent().build();
70 |
71 | } catch (SeerManagementException e) {
72 | log.error(e.getMessage(), e);
73 | return Response.serverError().entity("login service is temporarily unavailable, try again later").build();
74 | }
75 |
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/dao/DeviceDAO.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.dao;
2 |
3 | import com.mudie.seer.mgt.dto.Device;
4 | import com.mudie.seer.mgt.dto.DeviceRecord;
5 | import com.mudie.seer.mgt.exception.SeerManagementException;
6 |
7 | import java.util.List;
8 |
9 | public interface DeviceDAO {
10 |
11 | int addDevice(Device device) throws SeerManagementException;
12 |
13 | boolean updateDeviceName(String deviceName, int deviceId) throws SeerManagementException;
14 |
15 | boolean updateStatus(Device.Status status, int deviceId) throws SeerManagementException;
16 |
17 | boolean updateGroupId(int groupId, int deviceId) throws SeerManagementException;
18 |
19 | int getDeviceCount(String dpId) throws SeerManagementException;
20 |
21 | Device getDevice(int id) throws SeerManagementException;
22 |
23 | List getDevices(int switchId) throws SeerManagementException;
24 |
25 | List getDevices(String dpId) throws SeerManagementException;
26 |
27 | List getAllDevices(Device.Status status) throws SeerManagementException;
28 |
29 | DeviceRecord getDeviceRecord(String vlanId, String deviceMac) throws SeerManagementException;
30 |
31 | List getIoTDeviceRecord() throws SeerManagementException;
32 |
33 | boolean updateDeviceNameAndStatus(String deviceName,Device.Status status, int deviceId) throws SeerManagementException;
34 |
35 | boolean updateSwitchAndProperty(String property, int switchId, int deviceId) throws SeerManagementException;
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/dao/GroupDAO.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.dao;
2 |
3 | import com.mudie.seer.mgt.exception.SeerManagementException;
4 | import com.mudie.seer.mgt.dto.Group;
5 |
6 | public interface GroupDAO {
7 |
8 | int addGroup(Group group) throws SeerManagementException;
9 |
10 | boolean updateGroup(Group group) throws SeerManagementException;
11 |
12 | boolean updateGroupName(String name, int groupId) throws SeerManagementException;
13 |
14 | boolean removeGroup(int groupId) throws SeerManagementException;
15 |
16 | Group getGroup(String dpId, String deviceMac) throws SeerManagementException;
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/dao/SwitchDAO.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.dao;
2 |
3 | import com.mudie.seer.mgt.exception.SeerManagementException;
4 | import com.mudie.seer.mgt.dto.Switch;
5 |
6 | import java.util.List;
7 |
8 | public interface SwitchDAO {
9 |
10 | Switch getSwitch(String dpId) throws SeerManagementException;
11 |
12 | Switch getSwitchFromVxlanId(String vlanId) throws SeerManagementException;
13 |
14 | List getAllSwitches() throws SeerManagementException;
15 |
16 | int getSwitchesCount() throws SeerManagementException;
17 |
18 | List getSwitches(String username) throws SeerManagementException;
19 |
20 | List getSwitches() throws SeerManagementException;
21 |
22 | int addSwitch(Switch smSwitch) throws SeerManagementException;
23 |
24 | boolean updateStatus(String dpId, Switch.Status status) throws SeerManagementException;
25 |
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/dao/exception/IllegalTransactionStateException.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.dao.exception;
2 |
3 | public class IllegalTransactionStateException extends RuntimeException {
4 |
5 | private static final long serialVersionUID = -3151279331929070297L;
6 |
7 | public IllegalTransactionStateException(String msg, Exception nestedEx) {
8 | super(msg, nestedEx);
9 | }
10 |
11 | public IllegalTransactionStateException(String message, Throwable cause) {
12 | super(message, cause);
13 | }
14 |
15 | public IllegalTransactionStateException(String msg) {
16 | super(msg);
17 | }
18 |
19 | public IllegalTransactionStateException() {
20 | super();
21 | }
22 |
23 | public IllegalTransactionStateException(Throwable cause) {
24 | super(cause);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/dao/exception/TransactionManagementException.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.dao.exception;
2 |
3 | public class TransactionManagementException extends Exception {
4 |
5 | private static final long serialVersionUID = -3151279321929070297L;
6 |
7 | public TransactionManagementException(String msg, Exception nestedEx) {
8 | super(msg, nestedEx);
9 | }
10 |
11 | public TransactionManagementException(String message, Throwable cause) {
12 | super(message, cause);
13 | }
14 |
15 | public TransactionManagementException(String msg) {
16 | super(msg);
17 | }
18 |
19 | public TransactionManagementException() {
20 | super();
21 | }
22 |
23 | public TransactionManagementException(Throwable cause) {
24 | super(cause);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/dto/Device.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.dto;
2 |
3 | public class Device {
4 |
5 | private int id;
6 | private String mac;
7 | private String name;
8 | private long createdTimestamp;
9 | private long lastUpdatedTimestamp;
10 | private int switchId;
11 | private Status status;
12 | private int groupId;
13 | private String property;
14 |
15 | public enum Status {
16 | CREATED,
17 | IDENTIFIED,
18 | BLOCKED
19 | }
20 |
21 | public int getId() {
22 | return id;
23 | }
24 |
25 | public void setId(int id) {
26 | this.id = id;
27 | }
28 |
29 | public String getMac() {
30 | return mac;
31 | }
32 |
33 | public void setMac(String mac) {
34 | this.mac = mac;
35 | }
36 |
37 | public String getName() {
38 | return name;
39 | }
40 |
41 | public void setName(String name) {
42 | this.name = name;
43 | }
44 |
45 | public long getCreatedTimestamp() {
46 | return createdTimestamp;
47 | }
48 |
49 | public void setCreatedTimestamp(long createdTimestamp) {
50 | this.createdTimestamp = createdTimestamp;
51 | }
52 |
53 | public long getLastUpdatedTimestamp() {
54 | return lastUpdatedTimestamp;
55 | }
56 |
57 | public void setLastUpdatedTimestamp(long lastUpdatedTimestamp) {
58 | this.lastUpdatedTimestamp = lastUpdatedTimestamp;
59 | }
60 |
61 | public int getSwitchId() {
62 | return switchId;
63 | }
64 |
65 | public void setSwitchId(int switchId) {
66 | this.switchId = switchId;
67 | }
68 |
69 | public Status getStatus() {
70 | return status;
71 | }
72 |
73 | public void setStatus(Status status) {
74 | this.status = status;
75 | }
76 |
77 | public int getGroupId() {
78 | return groupId;
79 | }
80 |
81 | public void setGroupId(int groupId) {
82 | this.groupId = groupId;
83 | }
84 |
85 | public String getProperty() {
86 | return property;
87 | }
88 |
89 | public void setProperty(String property) {
90 | this.property = property;
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/dto/DeviceRecord.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.dto;
2 |
3 | public class DeviceRecord {
4 | private Device device;
5 | private Switch aSwitch;
6 | private Group group;
7 |
8 | public Device getDevice() {
9 | return device;
10 | }
11 |
12 | public void setDevice(Device device) {
13 | this.device = device;
14 | }
15 |
16 | public Switch getaSwitch() {
17 | return aSwitch;
18 | }
19 |
20 | public void setaSwitch(Switch aSwitch) {
21 | this.aSwitch = aSwitch;
22 | }
23 |
24 | public Group getGroup() {
25 | return group;
26 | }
27 |
28 | public void setGroup(Group group) {
29 | this.group = group;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/dto/Group.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.dto;
2 |
3 | public class Group {
4 |
5 | private int id;
6 | private String groupName;
7 | private int switchId;
8 | private Long dateOfCreation;
9 | private Long dateOfLastUpdate;
10 | private boolean quotoAppEnabled;
11 | private boolean parentalAppEnabled;
12 | private boolean securityAppEnabled;
13 | private long quota;
14 |
15 | public int getId() {
16 | return id;
17 | }
18 |
19 | public void setId(int id) {
20 | this.id = id;
21 | }
22 |
23 | public String getGroupName() {
24 | return groupName;
25 | }
26 |
27 | public void setGroupName(String groupName) {
28 | this.groupName = groupName;
29 | }
30 |
31 | public int getSwitchId() {
32 | return switchId;
33 | }
34 |
35 | public void setSwitchId(int switchId) {
36 | this.switchId = switchId;
37 | }
38 |
39 | public Long getDateOfCreation() {
40 | return dateOfCreation;
41 | }
42 |
43 | public void setDateOfCreation(Long dateOfCreation) {
44 | this.dateOfCreation = dateOfCreation;
45 | }
46 |
47 | public Long getDateOfLastUpdate() {
48 | return dateOfLastUpdate;
49 | }
50 |
51 | public void setDateOfLastUpdate(Long dateOfLastUpdate) {
52 | this.dateOfLastUpdate = dateOfLastUpdate;
53 | }
54 |
55 | public long getQuota() {
56 | return quota;
57 | }
58 |
59 | public void setQuota(long quota) {
60 | this.quota = quota;
61 | }
62 |
63 | public boolean isQuotoAppEnabled() {
64 | return quotoAppEnabled;
65 | }
66 |
67 | public void setQuotoAppEnabled(boolean quotoAppEnabled) {
68 | this.quotoAppEnabled = quotoAppEnabled;
69 | }
70 |
71 | public boolean isParentalAppEnabled() {
72 | return parentalAppEnabled;
73 | }
74 |
75 | public void setParentalAppEnabled(boolean parentalAppEnabled) {
76 | this.parentalAppEnabled = parentalAppEnabled;
77 | }
78 |
79 | public boolean isSecurityAppEnabled() {
80 | return securityAppEnabled;
81 | }
82 |
83 | public void setSecurityAppEnabled(boolean securityAppEnabled) {
84 | this.securityAppEnabled = securityAppEnabled;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/dto/Switch.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.dto;
2 |
3 | import java.sql.Timestamp;
4 | import java.util.Date;
5 |
6 | public class Switch {
7 |
8 | private int id;
9 | private String dpId;
10 | private Long dateOfCreation;
11 | private Long dateOfLastUpdate;
12 | private String owner;
13 | private long quota;
14 | private int billingDay;
15 | private Status status;
16 | private Timestamp billingDate;
17 |
18 | public enum Status {
19 | ACTIVE,
20 | BLOCK
21 | }
22 |
23 | public int getId() {
24 | return id;
25 | }
26 |
27 | public void setId(int id) {
28 | this.id = id;
29 | }
30 |
31 | public String getDpId() {
32 | return dpId;
33 | }
34 |
35 | public void setDpId(String dpId) {
36 | this.dpId = dpId;
37 | }
38 |
39 | public Long getDateOfCreation() {
40 | return dateOfCreation;
41 | }
42 |
43 | public void setDateOfCreation(Long dateOfCreation) {
44 | this.dateOfCreation = dateOfCreation;
45 | }
46 |
47 | public Long getDateOfLastUpdate() {
48 | return dateOfLastUpdate;
49 | }
50 |
51 | public void setDateOfLastUpdate(Long dateOfLastUpdate) {
52 | this.dateOfLastUpdate = dateOfLastUpdate;
53 | }
54 |
55 | public String getOwner() {
56 | return owner;
57 | }
58 |
59 | public void setOwner(String owner) {
60 | this.owner = owner;
61 | }
62 |
63 | public long getQuota() {
64 | return quota;
65 | }
66 |
67 | public void setQuota(long quota) {
68 | this.quota = quota;
69 | }
70 |
71 | public int getBillingDay() {
72 | return billingDay;
73 | }
74 |
75 | public void setBillingDay(int billingDay) {
76 | this.billingDay = billingDay;
77 | }
78 |
79 | public Status getStatus() {
80 | return status;
81 | }
82 |
83 | public void setStatus(Status status) {
84 | this.status = status;
85 | }
86 |
87 | public Timestamp getBillingDate() {
88 | return billingDate;
89 | }
90 |
91 | public void setBillingDate(Timestamp billingDate) {
92 | this.billingDate = billingDate;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/exception/SeerManagementException.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.exception;
2 |
3 | public class SeerManagementException extends Exception {
4 |
5 | public SeerManagementException(Exception e) {
6 | super(e);
7 | }
8 |
9 | public SeerManagementException(String msg, Exception e) {
10 | super(msg, e);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/internal/SeerManagementDataHolder.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.internal;
2 |
3 | import com.mudie.seer.mgt.service.SeerMgtService;
4 |
5 | public class SeerManagementDataHolder {
6 | private static SeerMgtService seerMgtService;
7 |
8 | public static SeerMgtService getSeerMgtService() {
9 | return seerMgtService;
10 | }
11 |
12 | public static void setSeerMgtService(SeerMgtService seerMgtService) {
13 | SeerManagementDataHolder.seerMgtService = seerMgtService;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/internal/SeerManagmentSeerPluginImpl.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.internal;
2 |
3 | import com.mudie.common.SeerPlugin;
4 | import com.mudie.common.config.SeerConfiguration;
5 | import com.mudie.seer.mgt.dao.SeerManagementDAOFactory;
6 | import com.mudie.seer.mgt.exception.SeerManagementException;
7 | import com.mudie.seer.mgt.dto.Switch;
8 | import com.mudie.seer.mgt.service.SeerMgtService;
9 | import org.slf4j.Logger;
10 | import org.slf4j.LoggerFactory;
11 |
12 | import java.util.ArrayList;
13 | import java.util.List;
14 | import java.util.ServiceLoader;
15 |
16 | public class SeerManagmentSeerPluginImpl implements SeerPlugin {
17 | private static final Logger log = LoggerFactory.getLogger(SeerManagmentSeerPluginImpl.class);
18 | private static final String DEFAULT_OWNER = "admin";
19 |
20 | @Override
21 | public void activate(SeerConfiguration seerConfiguration) {
22 | SeerManagementDAOFactory.init();
23 |
24 | SeerMgtService seerMgtService = null;
25 | ServiceLoader serviceLoader = ServiceLoader.load(SeerMgtService.class);
26 | for (SeerMgtService provider : serviceLoader) {
27 | seerMgtService = provider;
28 | }
29 | SeerManagementDataHolder.setSeerMgtService(seerMgtService);
30 |
31 | if (seerConfiguration.getSwitches() != null) {
32 | for (String dpId : seerConfiguration.getSwitches()) {
33 | try {
34 | Switch aswitch = seerMgtService.getSwitch(dpId);
35 | if (aswitch == null) {
36 | aswitch = new Switch();
37 | aswitch.setStatus(Switch.Status.ACTIVE);
38 | aswitch.setDpId(dpId);
39 | aswitch.setOwner(DEFAULT_OWNER);
40 | seerMgtService.addSwitch(aswitch);
41 | }
42 | } catch (SeerManagementException e) {
43 | log.error("Failed to add the switch", e);
44 | }
45 | }
46 | }
47 |
48 | }
49 |
50 | @Override
51 | public void deactivate() {
52 |
53 | }
54 |
55 | @Override
56 | public List getModuleDependencies() {
57 | List dependencies = new ArrayList<>();
58 | dependencies.add("com.mudie.datasource.internal.DatasourceSeerPluginImpl");
59 | return dependencies;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/service/SeerMgtService.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.service;
2 |
3 | import com.mudie.seer.mgt.dto.Device;
4 | import com.mudie.seer.mgt.dto.DeviceRecord;
5 | import com.mudie.seer.mgt.exception.SeerManagementException;
6 | import com.mudie.seer.mgt.dto.Group;
7 | import com.mudie.seer.mgt.dto.Switch;
8 |
9 | import java.util.List;
10 |
11 | public interface SeerMgtService {
12 |
13 | int addDevice(Device device) throws SeerManagementException;
14 |
15 | int addSwitch(Switch aswitch) throws SeerManagementException;
16 |
17 | Switch getSwitch(String dpId) throws SeerManagementException;
18 |
19 | Switch getSwitchFromVxlanId(String vxlanId) throws SeerManagementException;
20 |
21 | List getSwitches(String username) throws SeerManagementException;
22 |
23 | List getSwitches() throws SeerManagementException;
24 |
25 | List getDevices(String dpId) throws SeerManagementException;
26 |
27 | Group getGroup(String dpId, String deviceMac) throws SeerManagementException;
28 |
29 | DeviceRecord getDeviceRecord(String vlanId, String deviceMac) throws SeerManagementException;
30 |
31 | List getAllDevices(Device.Status status) throws SeerManagementException;
32 |
33 | List getIoTDeviceRecord() throws SeerManagementException;
34 |
35 | void updateDeviceName(String deviceName, int deviceId) throws SeerManagementException;
36 |
37 | void updateDeviceNameAndStatus(String deviceName,Device.Status status, int deviceId) throws SeerManagementException;
38 |
39 | void updateDevicePropertyAndSwitch(String property, int switchId, int deviceId) throws SeerManagementException;
40 | }
41 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/java/com/mudie/seer/mgt/util/SeerManagementDAOUtil.java:
--------------------------------------------------------------------------------
1 | package com.mudie.seer.mgt.util;
2 | import javax.naming.InitialContext;
3 | import javax.sql.DataSource;
4 | import java.sql.Connection;
5 | import java.sql.PreparedStatement;
6 | import java.sql.ResultSet;
7 | import java.sql.SQLException;
8 | import org.slf4j.Logger;
9 | import org.slf4j.LoggerFactory;
10 |
11 | public class SeerManagementDAOUtil {
12 |
13 | private static final Logger log = LoggerFactory.getLogger(SeerManagementDAOUtil.class);
14 |
15 | public static void cleanupResources(Connection conn, PreparedStatement stmt, ResultSet rs) {
16 | if (rs != null) {
17 | try {
18 | rs.close();
19 | } catch (SQLException e) {
20 | log.warn("Error occurred while closing result set", e);
21 | }
22 | }
23 | if (stmt != null) {
24 | try {
25 | stmt.close();
26 | } catch (SQLException e) {
27 | log.warn("Error occurred while closing prepared statement", e);
28 | }
29 | }
30 | if (conn != null) {
31 | try {
32 | conn.close();
33 | } catch (SQLException e) {
34 | log.warn("Error occurred while closing database connection", e);
35 | }
36 | }
37 | }
38 |
39 | public static void cleanupResources(PreparedStatement stmt, ResultSet rs) {
40 | if (rs != null) {
41 | try {
42 | rs.close();
43 | } catch (SQLException e) {
44 | log.warn("Error occurred while closing result set", e);
45 | }
46 | }
47 | if (stmt != null) {
48 | try {
49 | stmt.close();
50 | } catch (SQLException e) {
51 | log.warn("Error occurred while closing prepared statement", e);
52 | }
53 | }
54 | }
55 |
56 | public static DataSource lookupDataSource(String dataSourceName) {
57 | try {
58 | return (DataSource) InitialContext.doLookup(dataSourceName);
59 | } catch (Exception e) {
60 | throw new RuntimeException("Error in looking up data source: " + e.getMessage(), e);
61 | }
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/resources/META-INF/services/com.mudie.common.SeerApiPlugin:
--------------------------------------------------------------------------------
1 | com.mudie.seer.mgt.SeerMgtAdminRestApi
2 | com.mudie.seer.mgt.SeerMgtRestApi
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/resources/META-INF/services/com.mudie.common.SeerPlugin:
--------------------------------------------------------------------------------
1 | com.mudie.seer.mgt.internal.SeerManagmentSeerPluginImpl
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/main/resources/META-INF/services/com.mudie.seer.mgt.service.SeerMgtService:
--------------------------------------------------------------------------------
1 | com.mudie.seer.mgt.service.impl.SeerMgtServiceImpl
--------------------------------------------------------------------------------
/modules/core/seer-mgt/src/test/java/com/mudie/framework/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.mudie.framework;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/modules/packet-processor/vxlan-listener/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 |
6 | com.mudie
7 | product-seer
8 | 1.0.0-SNAPSHOT
9 | ../../../pom.xml
10 |
11 |
12 | vxlan-listener
13 | jar
14 |
15 | seer-common
16 | http://maven.apache.org
17 |
18 |
19 | UTF-8
20 |
21 |
22 |
23 |
24 | com.mudie
25 | seer-common
26 |
27 |
28 | io.netty
29 | netty-all
30 |
31 |
32 | org.slf4j
33 | slf4j-api
34 |
35 |
36 | junit
37 | junit
38 | 3.8.1
39 | test
40 |
41 |
42 | org.pcap4j
43 | pcap4j-core
44 |
45 |
46 | org.pcap4j
47 | pcap4j-packetfactory-static
48 |
49 |
50 |
51 |
52 |
53 | org.apache.maven.plugins
54 | maven-jar-plugin
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/modules/packet-processor/vxlan-listener/src/main/java/com/mudie/vxlan/listener/OsCheck.java:
--------------------------------------------------------------------------------
1 | package com.mudie.vxlan.listener;
2 |
3 | import java.util.Locale;
4 |
5 | public final class OsCheck {
6 | /**
7 | * types of Operating Systems
8 | */
9 | public enum OSType {
10 | Windows, MacOS, Linux, Other
11 | };
12 |
13 | // cached result of OS detection
14 | protected static OSType detectedOS;
15 |
16 | /**
17 | * detect the operating system from the os.name System property and cache
18 | * the result
19 | *
20 | * @returns - the operating system detected
21 | */
22 | public static OSType getOperatingSystemType() {
23 | if (detectedOS == null) {
24 | String OS = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH);
25 | if ((OS.indexOf("mac") >= 0) || (OS.indexOf("darwin") >= 0)) {
26 | detectedOS = OSType.MacOS;
27 | } else if (OS.indexOf("win") >= 0) {
28 | detectedOS = OSType.Windows;
29 | } else if (OS.indexOf("nux") >= 0) {
30 | detectedOS = OSType.Linux;
31 | } else {
32 | detectedOS = OSType.Other;
33 | }
34 | }
35 | return detectedOS;
36 | }
37 | }
--------------------------------------------------------------------------------
/modules/packet-processor/vxlan-listener/src/main/java/com/mudie/vxlan/listener/VxlanListener.java:
--------------------------------------------------------------------------------
1 | package com.mudie.vxlan.listener;
2 |
3 | import java.net.InetAddress;
4 | import java.net.UnknownHostException;
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | import io.netty.bootstrap.Bootstrap;
9 | import io.netty.channel.ChannelFuture;
10 | import io.netty.channel.ChannelInitializer;
11 | import io.netty.channel.ChannelOption;
12 | import io.netty.channel.epoll.EpollChannelOption;
13 | import io.netty.channel.nio.NioEventLoopGroup;
14 | import io.netty.channel.socket.nio.NioDatagramChannel;
15 | import io.netty.channel.ChannelPipeline;
16 | import org.slf4j.Logger;
17 | import org.slf4j.LoggerFactory;
18 |
19 | /**
20 | * This is based on the implementation described in https://sam.andrews-home.com/post/netty-doesnt-suck-at-udp-servers
21 | * linux version should be > 3.9
22 | */
23 | public class VxlanListener extends Thread {
24 | private static final int VXLAN_PORT = 4789;
25 | private static final Logger log = LoggerFactory.getLogger(VxlanListener.class);
26 | private static final String INET_HOST_ADDR = "0.0.0.0";
27 | private static final int THREADS = Runtime.getRuntime().availableProcessors() * 2; // Default EventLoopGroup Size
28 |
29 | @Override
30 | public void run() {
31 | final NioEventLoopGroup group = new NioEventLoopGroup();
32 | if (OsCheck.getOperatingSystemType()== OsCheck.OSType.Windows) {
33 | startOnWindows();
34 | } else {
35 | startOnLinux();
36 | }
37 | }
38 |
39 | public void startOnLinux() {
40 | final NioEventLoopGroup group = new NioEventLoopGroup(THREADS);
41 | InetAddress address = null;
42 | try {
43 | final Bootstrap bootstrap = new Bootstrap();
44 | bootstrap.group(group).channel(NioDatagramChannel.class)
45 | .option(ChannelOption.SO_BROADCAST, true)
46 | .option(EpollChannelOption.SO_REUSEPORT, true)
47 | .handler(new IncommingPacketHandler());
48 |
49 | // Bind and start to accept incoming connections.
50 | address = InetAddress.getLocalHost();
51 | log.info("Initializing vxlan packet listner on port " + VXLAN_PORT);
52 | List futures = new ArrayList<>(THREADS);
53 | // Bind THREADS times
54 | for(int i = 0; i < THREADS; ++i) {
55 | futures.add(bootstrap.bind(INET_HOST_ADDR, VXLAN_PORT).await());
56 | }
57 | // Now wait for all to be closed (if ever)
58 | for (final ChannelFuture future : futures) {
59 | future.channel().closeFuture().await();
60 | }
61 | } catch (InterruptedException e) {
62 | log.error("Listener thread interrupted ..", e);
63 | } catch (UnknownHostException e) {
64 | log.error("Invalid hostname" + address != null ? address.getHostName() : "");
65 | } finally {
66 | group.shutdownGracefully();
67 | }
68 | }
69 |
70 | public void startOnWindows() {
71 | final NioEventLoopGroup group = new NioEventLoopGroup();
72 | try {
73 | final Bootstrap b = new Bootstrap();
74 | b.group(group).channel(NioDatagramChannel.class)
75 | .option(ChannelOption.SO_BROADCAST, true)
76 | .handler(new ChannelInitializer() {
77 | @Override
78 | public void initChannel(final NioDatagramChannel ch) throws Exception {
79 | ChannelPipeline p = ch.pipeline();
80 | p.addLast(new IncommingPacketHandler());
81 | }
82 | });
83 |
84 | // Bind and start to accept incoming connections.
85 | InetAddress address = InetAddress.getLocalHost();
86 | log.info("Initializing vxlan packet listner on port " + VXLAN_PORT);
87 | b.bind(address,VXLAN_PORT).sync().channel().closeFuture().await();
88 |
89 | } catch (Exception e) {
90 | log.error("Error thrown on vx lan listener: ", e);
91 | } finally {
92 | group.shutdownGracefully();
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/modules/packet-processor/vxlan-listener/src/main/java/com/mudie/vxlan/listener/internal/VxLanListenerDataHolder.java:
--------------------------------------------------------------------------------
1 | package com.mudie.vxlan.listener.internal;
2 |
3 | import com.mudie.common.packet.PacketListener;
4 |
5 | import java.util.List;
6 |
7 | public class VxLanListenerDataHolder {
8 |
9 | private static List packetListeners;
10 |
11 | public static List getPacketListeners() {
12 | return packetListeners;
13 | }
14 |
15 | public static void setPacketListeners(List packetListeners) {
16 | VxLanListenerDataHolder.packetListeners = packetListeners;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/modules/packet-processor/vxlan-listener/src/main/java/com/mudie/vxlan/listener/internal/VxlanListenerSeerPluginImpl.java:
--------------------------------------------------------------------------------
1 | package com.mudie.vxlan.listener.internal;
2 |
3 | import com.mudie.common.SeerPlugin;
4 | import com.mudie.vxlan.listener.VxlanListener;
5 | import com.mudie.common.config.SeerConfiguration;
6 | import com.mudie.common.packet.PacketListener;
7 | import org.slf4j.Logger;
8 | import org.slf4j.LoggerFactory;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 | import java.util.ServiceLoader;
13 |
14 | public class VxlanListenerSeerPluginImpl implements SeerPlugin {
15 |
16 | private static final Logger log = LoggerFactory.getLogger(VxlanListenerSeerPluginImpl.class);
17 |
18 | @Override
19 | public void activate(SeerConfiguration seerConfiguration) {
20 | List packetListeners = new ArrayList<>();
21 | ServiceLoader serviceLoader = ServiceLoader.load(PacketListener.class);
22 | for (PacketListener provider : serviceLoader) {
23 | packetListeners.add(provider);
24 | }
25 | VxLanListenerDataHolder.setPacketListeners(packetListeners);
26 |
27 | new VxlanListener().start();
28 | }
29 |
30 | @Override
31 | public void deactivate() {
32 |
33 | }
34 |
35 | @Override
36 | public List getModuleDependencies() {
37 | return null;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/modules/packet-processor/vxlan-listener/src/main/resources/META-INF/services/com.mudie.common.SeerPlugin:
--------------------------------------------------------------------------------
1 | com.mudie.vxlan.listener.internal.VxlanListenerSeerPluginImpl
--------------------------------------------------------------------------------
/modules/packet-processor/vxlan-listener/src/test/java/com/mudie/framework/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.mudie.framework;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-collector/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 |
6 | com.mudie
7 | product-seer
8 | 1.0.0-SNAPSHOT
9 | ../../../pom.xml
10 |
11 |
12 | mud-collector
13 | jar
14 |
15 | mud-processor
16 | http://maven.apache.org
17 |
18 |
19 | UTF-8
20 |
21 |
22 |
23 |
24 | com.mudie
25 | seer-common
26 |
27 |
28 | com.mudie
29 | sdn-controller-mgt
30 |
31 |
32 | junit
33 | junit
34 | 3.8.1
35 | test
36 |
37 |
38 | org.slf4j
39 | slf4j-api
40 |
41 |
42 | io.swagger
43 | swagger-jersey2-jaxrs
44 |
45 |
46 | io.swagger
47 | swagger-annotations
48 |
49 |
50 | com.mudie
51 | seer-mgt
52 |
53 |
54 | org.pcap4j
55 | pcap4j-core
56 |
57 |
58 | com.google.guava
59 | guava
60 |
61 |
62 |
63 |
64 |
65 | org.apache.maven.plugins
66 | maven-jar-plugin
67 | 2.4
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-collector/src/main/java/com/mudie/mud/collector/DeviceIdentifier.java:
--------------------------------------------------------------------------------
1 | package com.mudie.mud.collector;
2 |
3 | public class DeviceIdentifier {
4 |
5 | private String vxlanId;
6 | private String deviceMac;
7 | private String mudUrl;
8 | private String name;
9 |
10 | public DeviceIdentifier(String vlanId, String deviceMac) {
11 | this.vxlanId = vlanId;
12 | this.deviceMac = deviceMac;
13 | }
14 |
15 | public String getMudUrl() {
16 | return mudUrl;
17 | }
18 |
19 | public void setMudUrl(String mudUrl) {
20 | this.mudUrl = mudUrl;
21 | }
22 |
23 | public String getVxlanId() {
24 | return vxlanId;
25 | }
26 |
27 | public void setVxlanId(String vxlanId) {
28 | this.vxlanId = vxlanId;
29 | }
30 |
31 | public String getDeviceMac() {
32 | return deviceMac;
33 | }
34 |
35 | public String getName() {
36 | return name;
37 | }
38 |
39 | public void setName(String name) {
40 | this.name = name;
41 | }
42 |
43 | public void setDeviceMac(String deviceMac) {
44 | this.deviceMac = deviceMac;
45 | }
46 |
47 | @Override
48 | public int hashCode() {
49 | int result = this.vxlanId.hashCode();
50 | result = 31 * result + ("@" + this.deviceMac).hashCode();
51 | return result;
52 | }
53 |
54 | @Override
55 | public boolean equals(Object obj) {
56 | return (obj instanceof DeviceIdentifier) && vxlanId.equals(
57 | ((DeviceIdentifier) obj).vxlanId) && deviceMac.equals(
58 | ((DeviceIdentifier) obj).deviceMac);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-collector/src/main/java/com/mudie/mud/collector/internal/MUDCollectorDataHolder.java:
--------------------------------------------------------------------------------
1 | package com.mudie.mud.collector.internal;
2 |
3 | import com.mudie.common.config.MUDController;
4 | import com.mudie.common.config.MudConfig;
5 | import com.mudie.mud.collector.MudieStatsCollector;
6 | import com.mudie.sdn.controller.mgt.OFController;
7 | import com.mudie.seer.mgt.service.SeerMgtService;
8 |
9 | import java.util.Map;
10 |
11 | public class MUDCollectorDataHolder {
12 | private static SeerMgtService seerMgtService;
13 | private static OFController ofController;
14 | private static Map mudDevices;
15 | private static MudConfig mudConfig;
16 | private static MudieStatsCollector mudieStatsCollector;
17 |
18 | public static SeerMgtService getSeerMgtService() {
19 | return seerMgtService;
20 | }
21 |
22 | public static void setSeerMgtService(SeerMgtService seerMgtService) {
23 | MUDCollectorDataHolder.seerMgtService = seerMgtService;
24 | }
25 |
26 | public static OFController getOfController() {
27 | return ofController;
28 | }
29 |
30 | public static void setOfController(OFController ofController) {
31 | MUDCollectorDataHolder.ofController = ofController;
32 | }
33 |
34 |
35 | public static String getMUDControllerValue(String urnId) {
36 | for (MUDController mudController : mudConfig.getMudControllers()) {
37 | if (mudController.getId().equals(urnId)) {
38 | return mudController.getValue();
39 | }
40 | }
41 | return null;
42 | }
43 |
44 | public static Map getMudDevices() {
45 | return mudDevices;
46 | }
47 |
48 | public static void setMudDevices(Map mudDevices) {
49 | MUDCollectorDataHolder.mudDevices = mudDevices;
50 | }
51 |
52 | public static MudConfig getMudConfig() {
53 | return mudConfig;
54 | }
55 |
56 | public static void setMudConfig(MudConfig mudConfig) {
57 | MUDCollectorDataHolder.mudConfig = mudConfig;
58 | }
59 |
60 | public static MudieStatsCollector getMudieStatsCollector() {
61 | return mudieStatsCollector;
62 | }
63 |
64 | public static void setMudieStatsCollector(MudieStatsCollector mudieStatsCollector) {
65 | MUDCollectorDataHolder.mudieStatsCollector = mudieStatsCollector;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-collector/src/main/java/com/mudie/mud/collector/internal/MUDCollectorSeerPluginImpl.java:
--------------------------------------------------------------------------------
1 | package com.mudie.mud.collector.internal;
2 |
3 | import com.mudie.common.SeerPlugin;
4 | import com.mudie.common.config.SeerConfiguration;
5 | import com.mudie.mud.collector.MudieStatsCollector;
6 | import com.mudie.sdn.controller.mgt.OFController;
7 | import com.mudie.seer.mgt.service.SeerMgtService;
8 | import org.slf4j.Logger;
9 | import org.slf4j.LoggerFactory;
10 |
11 | import java.util.*;
12 |
13 | public class MUDCollectorSeerPluginImpl implements SeerPlugin {
14 |
15 | private static final Logger log = LoggerFactory.getLogger(MUDCollectorSeerPluginImpl.class);
16 |
17 | @Override
18 | public void activate(SeerConfiguration seerConfiguration) {
19 | SeerMgtService seerMgtService = null;
20 | ServiceLoader serviceLoader = ServiceLoader.load(SeerMgtService.class);
21 | for (SeerMgtService provider : serviceLoader) {
22 | seerMgtService = provider;
23 | }
24 | MUDCollectorDataHolder.setSeerMgtService(seerMgtService);
25 |
26 | OFController ofControllerProvider = null;
27 | ServiceLoader ofControllerServiceLoader = ServiceLoader.load(OFController.class);
28 | for (OFController ofController : ofControllerServiceLoader) {
29 | ofControllerProvider = ofController;
30 | }
31 | MUDCollectorDataHolder.setOfController(ofControllerProvider);
32 | MUDCollectorDataHolder.setMudConfig(seerConfiguration.getMudConfig());
33 |
34 | MudieStatsCollector mudieStatsCollector = new MudieStatsCollector();
35 | MUDCollectorDataHolder.setMudieStatsCollector(mudieStatsCollector);
36 |
37 | }
38 |
39 | @Override
40 | public void deactivate() {
41 |
42 | }
43 |
44 | @Override
45 | public List getModuleDependencies() {
46 | List dependencies = new ArrayList<>();
47 | dependencies.add("com.mudie.seer.mgt.internal.SeerManagmentSeerPluginImpl");
48 | dependencies.add("com.mudie.sdn.controller.mgt.internal.SdnControllerSeerPluginImpl");
49 | return dependencies;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-collector/src/main/java/com/mudie/mud/collector/mudflowdto/DeviceMUDFlowMap.java:
--------------------------------------------------------------------------------
1 | package com.mudie.mud.collector.mudflowdto;
2 |
3 | import com.mudie.common.openflow.OFFlow;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 |
7 | import java.util.ArrayList;
8 | import java.util.HashMap;
9 | import java.util.List;
10 | import java.util.Map;
11 |
12 | public class DeviceMUDFlowMap {
13 | private static final Logger log = LoggerFactory.getLogger(DeviceMUDFlowMap.class);
14 |
15 | private Map> dnsIpMap = new HashMap<>();
16 | private List fromInternetDynamicFlows = new ArrayList<>();
17 | private List toInternetDynamicFlows = new ArrayList<>();
18 | private List fromInternetStaticFlows = new ArrayList<>();
19 | private List toInternetStaticFlows = new ArrayList<>();
20 | private List fromLocalStaticFlows = new ArrayList<>();
21 | private List toLocalStaticFlows = new ArrayList<>();
22 | private long longCacheTime;
23 | private long lastCheckedTimestamp;
24 |
25 | public List getFromInternetDynamicFlows() {
26 | return fromInternetDynamicFlows;
27 | }
28 |
29 | public void setFromInternetDynamicFlows(List fromInternetDynamicFlows) {
30 | this.fromInternetDynamicFlows = fromInternetDynamicFlows;
31 | }
32 |
33 | public List getToInternetDynamicFlows() {
34 | return toInternetDynamicFlows;
35 | }
36 |
37 | public void setToInternetDynamicFlows(List toInternetDynamicFlows) {
38 | this.toInternetDynamicFlows = toInternetDynamicFlows;
39 | }
40 |
41 | public List getFromInternetStaticFlows() {
42 | return fromInternetStaticFlows;
43 | }
44 |
45 | public void setFromInternetStaticFlows(List fromInternetStaticFlows) {
46 | this.fromInternetStaticFlows = fromInternetStaticFlows;
47 | }
48 |
49 | public List getToInternetStaticFlows() {
50 | return toInternetStaticFlows;
51 | }
52 |
53 | public void setToInternetStaticFlows(List toInternetStaticFlows) {
54 | this.toInternetStaticFlows = toInternetStaticFlows;
55 | }
56 |
57 | public List getFromLocalStaticFlows() {
58 | return fromLocalStaticFlows;
59 | }
60 |
61 | public void setFromLocalStaticFlows(List fromLocalStaticFlows) {
62 | this.fromLocalStaticFlows = fromLocalStaticFlows;
63 | }
64 |
65 | public List getToLocalStaticFlows() {
66 | return toLocalStaticFlows;
67 | }
68 |
69 | public void setToLocalStaticFlows(List toLocalStaticFlows) {
70 | this.toLocalStaticFlows = toLocalStaticFlows;
71 | }
72 |
73 |
74 | public long getLongCacheTime() {
75 | return longCacheTime;
76 | }
77 |
78 | public void setLongCacheTime(long longCacheTime) {
79 | this.longCacheTime = longCacheTime;
80 | }
81 |
82 | public long getLastCheckedTimestamp() {
83 | return lastCheckedTimestamp;
84 | }
85 |
86 | public void setLastCheckedTimestamp(long lastCheckedTimestamp) {
87 | this.lastCheckedTimestamp = lastCheckedTimestamp;
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-collector/src/main/java/com/mudie/mud/collector/mudflowdto/MudFeatureWrapper.java:
--------------------------------------------------------------------------------
1 | package com.mudie.mud.collector.mudflowdto;
2 |
3 | import com.mudie.common.openflow.OFFlow;
4 |
5 | import java.util.HashMap;
6 | import java.util.Map;
7 | import java.util.Set;
8 |
9 | public class MudFeatureWrapper {
10 |
11 | private Map staticFlows = new HashMap();
12 | private Map dynamicFlows = new HashMap();
13 | private Map lastStaticFlowRecords;
14 | private Map lastReactiveFlowRecords;
15 | private int flowOrder[];
16 |
17 | public MudFeatureWrapper(Set staticOfflows, Set dynamicOfflows) {
18 | staticOfflows.forEach(ofFlow -> staticFlows.put(ofFlow.hashCode(), ofFlow));
19 | dynamicOfflows.forEach(ofFlow -> dynamicFlows.put(ofFlow.hashCode(), ofFlow));
20 | }
21 |
22 | public Map getStaticFlows() {
23 | return staticFlows;
24 | }
25 |
26 | public void setStaticFlows(Map staticFlows) {
27 | this.staticFlows = staticFlows;
28 | }
29 |
30 | public Map getDynamicFlows() {
31 | return dynamicFlows;
32 | }
33 |
34 | public void setDynamicFlows(Map dynamicFlows) {
35 | this.dynamicFlows = dynamicFlows;
36 | }
37 |
38 | public void addStaticOFFlow(OFFlow ofFlow) {
39 | staticFlows.put(ofFlow.hashCode(), ofFlow);
40 | }
41 |
42 | public void addDynamicOFFlow(OFFlow ofFlow) {
43 | dynamicFlows.put(ofFlow.hashCode(), ofFlow);
44 | }
45 |
46 | public Map getLastStaticFlowRecords() {
47 | return lastStaticFlowRecords;
48 | }
49 |
50 | public void setLastStaticFlowRecords(Map lastStaticFlowRecords) {
51 | this.lastStaticFlowRecords = lastStaticFlowRecords;
52 | }
53 |
54 | public Map getLastReactiveFlowRecords() {
55 | return lastReactiveFlowRecords;
56 | }
57 |
58 | public void setLastReactiveFlowRecords(Map lastReactiveFlowRecords) {
59 | this.lastReactiveFlowRecords = lastReactiveFlowRecords;
60 | }
61 |
62 | public int[] getFlowOrder() {
63 | return flowOrder;
64 | }
65 |
66 | public void setFlowOrder(int[] flowOrder) {
67 | this.flowOrder = flowOrder;
68 | }
69 |
70 | public void resetDynamicFlowMetrics() {
71 | dynamicFlows.forEach((integer, ofFlow) -> {
72 | ofFlow.setPacketCount(0);
73 | ofFlow.setByteCount(0);
74 | });
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-collector/src/main/resources/META-INF/services/com.mudie.common.SeerPlugin:
--------------------------------------------------------------------------------
1 | com.mudie.mud.collector.internal.MUDCollectorSeerPluginImpl
--------------------------------------------------------------------------------
/modules/seer-apps/mud-collector/src/test/java/com/mudie/framework/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.mudie.framework;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 |
6 | com.mudie
7 | product-seer
8 | 1.0.0-SNAPSHOT
9 | ../../../pom.xml
10 |
11 |
12 | mud-processor
13 | jar
14 |
15 | mud-processor
16 | http://maven.apache.org
17 |
18 |
19 | UTF-8
20 |
21 |
22 |
23 |
24 | com.mudie
25 | seer-common
26 |
27 |
28 | com.mudie
29 | sdn-controller-mgt
30 |
31 |
32 | junit
33 | junit
34 | 3.8.1
35 | test
36 |
37 |
38 | org.slf4j
39 | slf4j-api
40 |
41 |
42 | io.swagger
43 | swagger-jersey2-jaxrs
44 |
45 |
46 | io.swagger
47 | swagger-annotations
48 |
49 |
50 | com.mudie
51 | seer-mgt
52 |
53 |
54 | org.pcap4j
55 | pcap4j-core
56 |
57 |
58 | com.google.guava
59 | guava
60 |
61 |
62 | org.apache.httpcomponents
63 | httpclient
64 |
65 |
66 |
67 |
68 |
69 | org.apache.maven.plugins
70 | maven-jar-plugin
71 | 2.4
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/java/com/mudie/mud/processor/DeviceIdentifier.java:
--------------------------------------------------------------------------------
1 | package com.mudie.mud.processor;
2 |
3 | public class DeviceIdentifier {
4 |
5 | private String vxlanId;
6 | private String deviceMac;
7 | private String mudUrl;
8 | private String name;
9 |
10 | public DeviceIdentifier(String vlanId, String deviceMac) {
11 | this.vxlanId = vlanId;
12 | this.deviceMac = deviceMac;
13 | }
14 |
15 | public String getMudUrl() {
16 | return mudUrl;
17 | }
18 |
19 | public void setMudUrl(String mudUrl) {
20 | this.mudUrl = mudUrl;
21 | }
22 |
23 | public String getVxlanId() {
24 | return vxlanId;
25 | }
26 |
27 | public void setVxlanId(String vxlanId) {
28 | this.vxlanId = vxlanId;
29 | }
30 |
31 | public String getDeviceMac() {
32 | return deviceMac;
33 | }
34 |
35 | public String getName() {
36 | return name;
37 | }
38 |
39 | public void setName(String name) {
40 | this.name = name;
41 | }
42 |
43 | public void setDeviceMac(String deviceMac) {
44 | this.deviceMac = deviceMac;
45 | }
46 |
47 | @Override
48 | public int hashCode() {
49 | int result = this.vxlanId.hashCode();
50 | result = 31 * result + ("@" + this.deviceMac).hashCode();
51 | return result;
52 | }
53 |
54 | @Override
55 | public boolean equals(Object obj) {
56 | return (obj instanceof DeviceIdentifier) && vxlanId.equals(
57 | ((DeviceIdentifier) obj).vxlanId) && deviceMac.equals(
58 | ((DeviceIdentifier) obj).deviceMac);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/java/com/mudie/mud/processor/DeviceMUDFlowMap.java:
--------------------------------------------------------------------------------
1 | package com.mudie.mud.processor;
2 |
3 | import com.mudie.common.openflow.OFFlow;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 |
7 | import java.util.ArrayList;
8 | import java.util.HashMap;
9 | import java.util.List;
10 | import java.util.Map;
11 |
12 | public class DeviceMUDFlowMap {
13 | private static final Logger log = LoggerFactory.getLogger(DeviceMUDFlowMap.class);
14 | private static int MAXIP_PER_DNS = 20;
15 |
16 | private Map> dnsIpMap = new HashMap<>();
17 | private List fromInternetDynamicFlows = new ArrayList<>();
18 | private List toInternetDynamicFlows = new ArrayList<>();
19 | private List fromInternetStaticFlows = new ArrayList<>();
20 | private List toInternetStaticFlows = new ArrayList<>();
21 | private List fromLocalStaticFlows = new ArrayList<>();
22 | private List toLocalStaticFlows = new ArrayList<>();
23 | private long longCacheTime;
24 | private long lastCheckedTimestamp;
25 |
26 | public Map> getDnsIpMap() {
27 | return dnsIpMap;
28 | }
29 |
30 | public void setDnsIpMap(Map> dnsIpMap) {
31 | this.dnsIpMap = dnsIpMap;
32 | }
33 |
34 | public List getFromInternetDynamicFlows() {
35 | return fromInternetDynamicFlows;
36 | }
37 |
38 | public void setFromInternetDynamicFlows(List fromInternetDynamicFlows) {
39 | this.fromInternetDynamicFlows = fromInternetDynamicFlows;
40 | }
41 |
42 | public List getToInternetDynamicFlows() {
43 | return toInternetDynamicFlows;
44 | }
45 |
46 | public void setToInternetDynamicFlows(List toInternetDynamicFlows) {
47 | this.toInternetDynamicFlows = toInternetDynamicFlows;
48 | }
49 |
50 | public List getFromInternetStaticFlows() {
51 | return fromInternetStaticFlows;
52 | }
53 |
54 | public void setFromInternetStaticFlows(List fromInternetStaticFlows) {
55 | this.fromInternetStaticFlows = fromInternetStaticFlows;
56 | }
57 |
58 | public List getToInternetStaticFlows() {
59 | return toInternetStaticFlows;
60 | }
61 |
62 | public void setToInternetStaticFlows(List toInternetStaticFlows) {
63 | this.toInternetStaticFlows = toInternetStaticFlows;
64 | }
65 |
66 | public List getFromLocalStaticFlows() {
67 | return fromLocalStaticFlows;
68 | }
69 |
70 | public void setFromLocalStaticFlows(List fromLocalStaticFlows) {
71 | this.fromLocalStaticFlows = fromLocalStaticFlows;
72 | }
73 |
74 | public List getToLocalStaticFlows() {
75 | return toLocalStaticFlows;
76 | }
77 |
78 | public void setToLocalStaticFlows(List toLocalStaticFlows) {
79 | this.toLocalStaticFlows = toLocalStaticFlows;
80 | }
81 |
82 | public void addDnsIps(String dns, List ips) {
83 | if (dnsIpMap.get(dns) == null) {
84 | dnsIpMap.put(dns, ips);
85 | } else {
86 | List ipholder = dnsIpMap.get(dns);
87 | if (ips.size() > MAXIP_PER_DNS) {
88 | log.error("ips size is too long" + ips.size() + " for " + dns);
89 | }
90 | if (ipholder.size() + ips.size() > MAXIP_PER_DNS) {
91 | int toRemove = MAXIP_PER_DNS - (ipholder.size() + ips.size());
92 | if (toRemove > 0) {
93 | for (int i = 0; i < toRemove; i++) {
94 | ipholder.remove(0);
95 | }
96 | }
97 | }
98 | ipholder.addAll(ips);
99 | dnsIpMap.put(dns, ipholder);
100 | }
101 | }
102 |
103 | public String getDns(String ip) {
104 | for (String dns : dnsIpMap.keySet()) {
105 | if (dnsIpMap.get(dns).contains(ip)) {
106 | return dns;
107 | }
108 | }
109 | return null;
110 | }
111 |
112 | public long getLongCacheTime() {
113 | return longCacheTime;
114 | }
115 |
116 | public void setLongCacheTime(long longCacheTime) {
117 | this.longCacheTime = longCacheTime;
118 | }
119 |
120 | public long getLastCheckedTimestamp() {
121 | return lastCheckedTimestamp;
122 | }
123 |
124 | public void setLastCheckedTimestamp(long lastCheckedTimestamp) {
125 | this.lastCheckedTimestamp = lastCheckedTimestamp;
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/java/com/mudie/mud/processor/dhcp/BasePacket.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011, Big Switch Networks, Inc.
3 | * Originally created by David Erickson, Stanford University
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 | * not use this file except in compliance with the License. You may obtain
7 | * a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * License for the specific language governing permissions and limitations
15 | * under the License.
16 | **/
17 |
18 | package com.mudie.mud.processor.dhcp;
19 |
20 | import org.slf4j.Logger;
21 | import org.slf4j.LoggerFactory;
22 |
23 |
24 | /**
25 | *
26 | * @author David Erickson (daviderickson@cs.stanford.edu)
27 | */
28 | public abstract class BasePacket implements IPacket {
29 | public static final Logger log = LoggerFactory.getLogger(BasePacket.class);
30 | protected IPacket parent;
31 | protected IPacket payload;
32 |
33 | /**
34 | * @return the parent
35 | */
36 | @Override
37 | public IPacket getParent() {
38 | return parent;
39 | }
40 |
41 | /**
42 | * @param parent the parent to set
43 | */
44 | @Override
45 | public IPacket setParent(IPacket parent) {
46 | this.parent = parent;
47 | return this;
48 | }
49 |
50 | /**
51 | * @return the payload
52 | */
53 | @Override
54 | public IPacket getPayload() {
55 | return payload;
56 | }
57 |
58 | /**
59 | * @param payload the payload to set
60 | */
61 | @Override
62 | public IPacket setPayload(IPacket payload) {
63 | this.payload = payload;
64 | return this;
65 | }
66 |
67 | @Override
68 | public void resetChecksum() {
69 | if (this.parent != null)
70 | this.parent.resetChecksum();
71 | }
72 |
73 | /* (non-Javadoc)
74 | * @see java.lang.Object#hashCode()
75 | */
76 | @Override
77 | public int hashCode() {
78 | final int prime = 6733;
79 | int result = 1;
80 | result = prime * result + ((payload == null) ? 0 : payload.hashCode());
81 | return result;
82 | }
83 |
84 | /* (non-Javadoc)
85 | * @see java.lang.Object#equals(java.lang.Object)
86 | */
87 | @Override
88 | public boolean equals(Object obj) {
89 | if (this == obj)
90 | return true;
91 | if (obj == null)
92 | return false;
93 | if (!(obj instanceof BasePacket))
94 | return false;
95 | BasePacket other = (BasePacket) obj;
96 | if (payload == null) {
97 | if (other.payload != null)
98 | return false;
99 | } else if (!payload.equals(other.payload))
100 | return false;
101 | return true;
102 | }
103 |
104 | @Override
105 | public Object clone() {
106 | IPacket pkt;
107 | try {
108 | pkt = this.getClass().newInstance();
109 | } catch (Exception e) {
110 | throw new RuntimeException("Could not clone packet");
111 | }
112 | // TODO: we are using serialize()/deserialize() to perform the
113 | // cloning. Not the most efficient way but simple. We can revisit
114 | // if we hit performance problems.
115 | byte[] data = this.serialize();
116 | try {
117 | pkt.deserialize(this.serialize(), 0, data.length);
118 | } catch (PacketParsingException e) {
119 | // This shouldn't happen here, since we already deserialized it once
120 | return new Data(data);
121 | }
122 | pkt.setParent(this.parent);
123 | return pkt;
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/java/com/mudie/mud/processor/dhcp/DHCPOption.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011, Big Switch Networks, Inc.
3 | * Originally created by David Erickson, Stanford University
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 | * not use this file except in compliance with the License. You may obtain
7 | * a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * License for the specific language governing permissions and limitations
15 | * under the License.
16 | **/
17 |
18 | package com.mudie.mud.processor.dhcp;
19 |
20 | import java.util.Arrays;
21 |
22 | /**
23 | *
24 | * @author David Erickson (daviderickson@cs.stanford.edu)
25 | */
26 | public class DHCPOption {
27 | protected byte code;
28 | protected byte length;
29 | protected byte[] data;
30 |
31 | /**
32 | * @return the code
33 | */
34 | public byte getCode() {
35 | return code;
36 | }
37 |
38 | /**
39 | * @param code the code to set
40 | */
41 | public DHCPOption setCode(byte code) {
42 | this.code = code;
43 | return this;
44 | }
45 |
46 | /**
47 | * @return the length
48 | */
49 | public byte getLength() {
50 | return length;
51 | }
52 |
53 | /**
54 | * @param length the length to set
55 | */
56 | public DHCPOption setLength(byte length) {
57 | this.length = length;
58 | return this;
59 | }
60 |
61 | /**
62 | * @return the data
63 | */
64 | public byte[] getData() {
65 | return data;
66 | }
67 |
68 | /**
69 | * @param data the data to set
70 | */
71 | public DHCPOption setData(byte[] data) {
72 | this.data = data;
73 | return this;
74 | }
75 |
76 | /* (non-Javadoc)
77 | * @see java.lang.Object#hashCode()
78 | */
79 | @Override
80 | public int hashCode() {
81 | final int prime = 31;
82 | int result = 1;
83 | result = prime * result + code;
84 | result = prime * result + Arrays.hashCode(data);
85 | result = prime * result + length;
86 | return result;
87 | }
88 |
89 | /* (non-Javadoc)
90 | * @see java.lang.Object#equals(java.lang.Object)
91 | */
92 | @Override
93 | public boolean equals(Object obj) {
94 | if (this == obj)
95 | return true;
96 | if (obj == null)
97 | return false;
98 | if (!(obj instanceof DHCPOption))
99 | return false;
100 | DHCPOption other = (DHCPOption) obj;
101 | if (code != other.code)
102 | return false;
103 | if (!Arrays.equals(data, other.data))
104 | return false;
105 | if (length != other.length)
106 | return false;
107 | return true;
108 | }
109 |
110 | /* (non-Javadoc)
111 | * @see java.lang.Object#toString()
112 | */
113 | @Override
114 | public String toString() {
115 | return "DHCPOption [code=" + code + ", length=" + length + ", data="
116 | + Arrays.toString(data) + "]";
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/java/com/mudie/mud/processor/dhcp/DHCPPacketType.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011, Big Switch Networks, Inc.
3 | * Originally created by David Erickson, Stanford University
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 | * not use this file except in compliance with the License. You may obtain
7 | * a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * License for the specific language governing permissions and limitations
15 | * under the License.
16 | **/
17 |
18 | package com.mudie.mud.processor.dhcp;
19 |
20 | public enum DHCPPacketType {
21 | // From RFC 1533
22 | DHCPDISCOVER (1),
23 | DHCPOFFER (2),
24 | DHCPREQUEST (3),
25 | DHCPDECLINE (4),
26 | DHCPACK (5),
27 | DHCPNAK (6),
28 | DHCPRELEASE (7),
29 |
30 | // From RFC2132
31 | DHCPINFORM (8),
32 |
33 | // From RFC3203
34 | DHCPFORCERENEW (9),
35 |
36 | // From RFC4388
37 | DHCPLEASEQUERY (10),
38 | DHCPLEASEUNASSIGNED (11),
39 | DHCPLEASEUNKNOWN (12),
40 | DHCPLEASEACTIVE (13);
41 |
42 | protected int value;
43 |
44 | private DHCPPacketType(int value) {
45 | this.value = value;
46 | }
47 |
48 | public int getValue() {
49 | return value;
50 | }
51 |
52 | public String toString(){
53 | switch (value) {
54 | case 1:
55 | return "DHCPDISCOVER";
56 | case 2:
57 | return "DHCPOFFER";
58 | case 3:
59 | return "DHCPREQUEST";
60 | case 4:
61 | return "DHCPDECLINE";
62 | case 5:
63 | return "DHCPACK";
64 | case 6:
65 | return "DHCPNAK";
66 | case 7:
67 | return "DHCPRELEASE";
68 | case 8:
69 | return "DHCPINFORM";
70 | case 9:
71 | return "DHCPFORCERENEW";
72 | case 10:
73 | return "DHCPLEASEQUERY";
74 | case 11:
75 | return "DHCPLEASEUNASSIGNED";
76 | case 12:
77 | return "DHCPLEASEUNKNOWN";
78 | case 13:
79 | return "DHCPLEASEACTIVE";
80 | default:
81 | return "UNKNOWN";
82 | }
83 | }
84 | public static DHCPPacketType getType(int value) {
85 | switch (value) {
86 | case 1:
87 | return DHCPDISCOVER;
88 | case 2:
89 | return DHCPOFFER;
90 | case 3:
91 | return DHCPREQUEST;
92 | case 4:
93 | return DHCPDECLINE;
94 | case 5:
95 | return DHCPACK;
96 | case 6:
97 | return DHCPNAK;
98 | case 7:
99 | return DHCPRELEASE;
100 | case 8:
101 | return DHCPINFORM;
102 | case 9:
103 | return DHCPFORCERENEW;
104 | case 10:
105 | return DHCPLEASEQUERY;
106 | case 11:
107 | return DHCPLEASEUNASSIGNED;
108 | case 12:
109 | return DHCPLEASEUNKNOWN;
110 | case 13:
111 | return DHCPLEASEACTIVE;
112 | }
113 |
114 | return null;
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/java/com/mudie/mud/processor/dhcp/Data.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011, Big Switch Networks, Inc.
3 | * Originally created by David Erickson, Stanford University
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 | * not use this file except in compliance with the License. You may obtain
7 | * a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * License for the specific language governing permissions and limitations
15 | * under the License.
16 | **/
17 |
18 | package com.mudie.mud.processor.dhcp;
19 |
20 | import java.util.Arrays;
21 |
22 | /**
23 | *
24 | * @author David Erickson (daviderickson@cs.stanford.edu)
25 | */
26 | public class Data extends BasePacket {
27 | protected byte[] data;
28 |
29 | /**
30 | *
31 | */
32 | public Data() {
33 | }
34 |
35 | /**
36 | * @param data
37 | */
38 | public Data(byte[] data) {
39 | this.data = data;
40 | }
41 |
42 | /**
43 | * @return the data
44 | */
45 | public byte[] getData() {
46 | return data;
47 | }
48 |
49 | /**
50 | * @param data the data to set
51 | */
52 | public Data setData(byte[] data) {
53 | this.data = data;
54 | return this;
55 | }
56 |
57 | public byte[] serialize() {
58 | return this.data;
59 | }
60 |
61 | @Override
62 | public IPacket deserialize(byte[] data, int offset, int length) {
63 | this.data = Arrays.copyOfRange(data, offset, offset + length);
64 | return this;
65 | }
66 |
67 | /* (non-Javadoc)
68 | * @see java.lang.Object#hashCode()
69 | */
70 | @Override
71 | public int hashCode() {
72 | final int prime = 1571;
73 | int result = super.hashCode();
74 | result = prime * result + Arrays.hashCode(data);
75 | return result;
76 | }
77 |
78 | /* (non-Javadoc)
79 | * @see java.lang.Object#equals(java.lang.Object)
80 | */
81 | @Override
82 | public boolean equals(Object obj) {
83 | if (this == obj)
84 | return true;
85 | if (!super.equals(obj))
86 | return false;
87 | if (!(obj instanceof Data))
88 | return false;
89 | Data other = (Data) obj;
90 | if (!Arrays.equals(data, other.data))
91 | return false;
92 | return true;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/java/com/mudie/mud/processor/dhcp/IPacket.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011, Big Switch Networks, Inc.
3 | * Originally created by David Erickson, Stanford University
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 | * not use this file except in compliance with the License. You may obtain
7 | * a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * License for the specific language governing permissions and limitations
15 | * under the License.
16 | **/
17 |
18 | package com.mudie.mud.processor.dhcp;
19 |
20 | /**
21 | *
22 | * @author David Erickson (daviderickson@cs.stanford.edu)
23 | */
24 | public interface IPacket {
25 | /**
26 | *
27 | * @return
28 | */
29 | public IPacket getPayload();
30 |
31 | /**
32 | *
33 | * @param packet
34 | * @return
35 | */
36 | public IPacket setPayload(IPacket packet);
37 |
38 | /**
39 | *
40 | * @return
41 | */
42 | public IPacket getParent();
43 |
44 | /**
45 | *
46 | * @param packet
47 | * @return
48 | */
49 | public IPacket setParent(IPacket packet);
50 |
51 | /**
52 | * Reset any checksums as needed, and call resetChecksum on all parents
53 | */
54 | public void resetChecksum();
55 |
56 | /**
57 | * Sets all payloads parent packet if applicable, then serializes this
58 | * packet and all payloads
59 | * @return a byte[] containing this packet and payloads
60 | */
61 | public byte[] serialize();
62 |
63 | /**
64 | * Deserializes this packet layer and all possible payloads
65 | * @param data
66 | * @param offset offset to start deserializing from
67 | * @param length length of the data to deserialize
68 | * @return the deserialized data
69 | */
70 | public IPacket deserialize(byte[] data, int offset, int length)
71 | throws PacketParsingException;
72 |
73 | /** Clone this packet and its payload packet but not its parent.
74 | *
75 | * @return
76 | */
77 | public Object clone();
78 | }
79 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/java/com/mudie/mud/processor/dhcp/PacketParsingException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2013, Big Switch Networks, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use this file except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | **/
16 |
17 | package com.mudie.mud.processor.dhcp;
18 |
19 | public class PacketParsingException extends Exception {
20 |
21 | public PacketParsingException(String msg) {
22 | super(msg);
23 | }
24 |
25 | private static final long serialVersionUID = -1177841297678875573L;
26 |
27 | }
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/java/com/mudie/mud/processor/exception/MUDProcessorException.java:
--------------------------------------------------------------------------------
1 | package com.mudie.mud.processor.exception;
2 |
3 | public class MUDProcessorException extends Exception {
4 |
5 | public MUDProcessorException(Exception e) {
6 | super(e);
7 | }
8 |
9 | public MUDProcessorException(String msg, Exception e) {
10 | super(msg, e);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/java/com/mudie/mud/processor/internal/MUDProcesserDataHolder.java:
--------------------------------------------------------------------------------
1 | package com.mudie.mud.processor.internal;
2 |
3 | import com.mudie.common.config.MUDController;
4 | import com.mudie.common.config.MudConfig;
5 | import com.mudie.sdn.controller.mgt.OFController;
6 | import com.mudie.seer.mgt.service.SeerMgtService;
7 |
8 | import java.util.Map;
9 |
10 | public class MUDProcesserDataHolder {
11 | private static SeerMgtService seerMgtService;
12 | private static OFController ofController;
13 | private static Map mudDevices;
14 | private static MudConfig mudConfig;
15 |
16 | public static SeerMgtService getSeerMgtService() {
17 | return seerMgtService;
18 | }
19 |
20 | public static void setSeerMgtService(SeerMgtService seerMgtService) {
21 | MUDProcesserDataHolder.seerMgtService = seerMgtService;
22 | }
23 |
24 | public static OFController getOfController() {
25 | return ofController;
26 | }
27 |
28 | public static void setOfController(OFController ofController) {
29 | MUDProcesserDataHolder.ofController = ofController;
30 | }
31 |
32 |
33 | public static String getMUDControllerValue(String urnId) {
34 | for (MUDController mudController : mudConfig.getMudControllers()) {
35 | if (mudController.getId().equals(urnId)) {
36 | return mudController.getValue();
37 | }
38 | }
39 | return null;
40 | }
41 |
42 | public static Map getMudDevices() {
43 | return mudDevices;
44 | }
45 |
46 | public static void setMudDevices(Map mudDevices) {
47 | MUDProcesserDataHolder.mudDevices = mudDevices;
48 | }
49 |
50 | public static MudConfig getMudConfig() {
51 | return mudConfig;
52 | }
53 |
54 | public static void setMudConfig(MudConfig mudConfig) {
55 | MUDProcesserDataHolder.mudConfig = mudConfig;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/java/com/mudie/mud/processor/internal/MUDProcessorSeerPluginImpl.java:
--------------------------------------------------------------------------------
1 | package com.mudie.mud.processor.internal;
2 |
3 | import com.mudie.common.SeerDirectory;
4 | import com.mudie.common.SeerPlugin;
5 | import com.mudie.common.config.SeerConfiguration;
6 | import com.mudie.sdn.controller.mgt.OFController;
7 | import com.mudie.seer.mgt.service.SeerMgtService;
8 | import org.slf4j.Logger;
9 | import org.slf4j.LoggerFactory;
10 |
11 | import java.io.*;
12 | import java.util.*;
13 |
14 | public class MUDProcessorSeerPluginImpl implements SeerPlugin {
15 |
16 | private static final Logger log = LoggerFactory.getLogger(MUDProcessorSeerPluginImpl.class);
17 |
18 | @Override
19 | public void activate(SeerConfiguration seerConfiguration) {
20 | SeerMgtService seerMgtService = null;
21 | ServiceLoader serviceLoader = ServiceLoader.load(SeerMgtService.class);
22 | for (SeerMgtService provider : serviceLoader) {
23 | seerMgtService = provider;
24 | }
25 | MUDProcesserDataHolder.setSeerMgtService(seerMgtService);
26 |
27 | OFController ofControllerProvider = null;
28 | ServiceLoader ofControllerServiceLoader = ServiceLoader.load(OFController.class);
29 | for (OFController ofController : ofControllerServiceLoader) {
30 | ofControllerProvider = ofController;
31 | }
32 | MUDProcesserDataHolder.setOfController(ofControllerProvider);
33 | MUDProcesserDataHolder.setMudConfig(seerConfiguration.getMudConfig());
34 |
35 | String mudDevicePath = SeerDirectory.getConfigDirectory() + File.separator + "mud-device-list.csv";
36 |
37 | BufferedReader br = null;
38 | String line = "";
39 | String cvsSplitBy = ",";
40 | Map mudDevices = new HashMap<>();
41 | try {
42 |
43 | br = new BufferedReader(new FileReader(mudDevicePath));
44 | while ((line = br.readLine()) != null) {
45 | // use comma as separator
46 | String[] entries = line.split(cvsSplitBy);
47 | if (entries.length == 2) {
48 | mudDevices.put(entries[0], entries[1]);
49 | }
50 | }
51 |
52 | } catch (IOException e) {
53 | log.error("Failed to process mud-device-list.csv file", e);
54 | } finally {
55 | if (br != null) {
56 | try {
57 | br.close();
58 | } catch (IOException e) {
59 | log.error("Failed to close process mud-device-list.csv file", e);
60 | }
61 | }
62 | }
63 | MUDProcesserDataHolder.setMudDevices(mudDevices);
64 | }
65 |
66 | @Override
67 | public void deactivate() {
68 |
69 | }
70 |
71 | @Override
72 | public List getModuleDependencies() {
73 | List dependencies = new ArrayList<>();
74 | dependencies.add("com.mudie.seer.mgt.internal.SeerManagmentSeerPluginImpl");
75 | dependencies.add("com.mudie.sdn.controller.mgt.internal.SdnControllerSeerPluginImpl");
76 | return dependencies;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/resources/META-INF/services/com.mudie.common.SeerPlugin:
--------------------------------------------------------------------------------
1 | com.mudie.mud.processor.internal.MUDProcessorSeerPluginImpl
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/main/resources/META-INF/services/com.mudie.common.packet.PacketListener:
--------------------------------------------------------------------------------
1 | com.mudie.mud.processor.MUDProcessorPacketListenerImpl
--------------------------------------------------------------------------------
/modules/seer-apps/mud-processor/src/test/java/com/mudie/framework/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.mudie.framework;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/resources/bin/version.txt:
--------------------------------------------------------------------------------
1 | 1.0.0-SNAPSHOT
--------------------------------------------------------------------------------
/resources/conf/deployment.yml:
--------------------------------------------------------------------------------
1 | server:
2 |
3 | requestLog:
4 | appenders: []
5 | # - type: console
6 | # layout:
7 | # type: access-json
8 | # timestampFormat: "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
9 | # requestHeaders:
10 | # - User-Agent
11 | # - X-Request-Id
12 |
13 | applicationConnectors:
14 | - type: http
15 | port: 9000
16 | # - type: https
17 | # port: 8443
18 | # keyStorePath: keystores/seer.jks
19 | # keyStorePassword: seer
20 | # keyStoreType: JKS
21 |
22 | adminConnectors:
23 | - type: http
24 | port: 9001
25 | # - type: https
26 | # port: 8444
27 | # keyStorePath: keystores/seer.jks
28 | # keyStorePassword: seer
29 | # keyStoreType: JKS
30 | # trustStorePath: /path/to/file
31 | # trustStorePassword: changeit
32 | # trustStoreType: JKS
33 |
34 | controller:
35 | type: faucet
36 | # hostname: ${CTR_HOSTNAME:-localhost}
37 | # port: ${CTR_PORT:-8080}
38 | hostname: localhost
39 | port: 4222
40 | properties:
41 | username: "faucet"
42 | password: "faucet"
43 | dbName: "faucet"
44 | dbUrl: "http://localhost:8086"
45 |
46 | logging:
47 | level: ERROR
48 | loggers:
49 | com.mudie: INFO
50 | # feign: DEBUG
51 | appenders:
52 | - type: console
53 | threshold: INFO
54 | - type: file
55 | currentLogFilename: logs/mud-ie.log
56 | logFormat: "%-6level [%d{HH:mm:ss.SSS}] [%t] %logger{5} - %X{code} %msg %n"
57 | threshold: INFO
58 | archive: true
59 | archivedLogFilenamePattern: logs/mud-ie-%d{yyyy-MM-dd}-%i.log
60 | archivedFileCount: 10
61 | timeZone: UTC
62 | maxFileSize: 10Mb
63 |
64 |
65 | mudConfig:
66 | mudPacketLogging: true
67 | mudReactiveIdleTimeout: 7200
68 | summerizationTimeInSeconds: 60
69 | mudControllers:
70 | - id: "urn:ietf:params:mud:dns"
71 | value: "192.168.1.1"
72 | - id: "urn:ietf:params:mud:ntp"
73 | value: "192.168.1.1"
74 | - id: "urn:ietf:params:mud:gateway"
75 | value: "192.168.1.1"
76 |
77 | switches:
78 | - "14cc205133ea"
79 |
80 | swagger: True
81 |
--------------------------------------------------------------------------------
/resources/conf/mud-device-list.csv:
--------------------------------------------------------------------------------
1 | 50:c7:bf:00:56:39,http://iotanalytics.unsw.edu.au/mud/tplinkplugMud.json
2 | ec:1a:59:79:f4:89,http://iotanalytics.unsw.edu.au/mud/wemoswitchMud.json
3 | 00:16:6c:ab:6b:88,http://iotanalytics.unsw.edu.au/mud/samsungsmartcamMud.json
4 | 70:ee:50:18:34:43,http://iotanalytics.unsw.edu.au/mud/NetatmoCameraMud.json
5 | ec:1a:59:83:28:11,http://iotanalytics.unsw.edu.au/mud/wemomotionMud.json
--------------------------------------------------------------------------------
/resources/datasources/seer-mgt.properties:
--------------------------------------------------------------------------------
1 | jndiName=seer_mgt
2 | jdbcUrl=jdbc:h2:database/SeerMgt;DB_CLOSE_ON_EXIT=FALSE;AUTO_SERVER=TRUE
3 | dataSource.user=seer
4 | dataSource.password=seer
5 |
--------------------------------------------------------------------------------
/resources/dbscripts/seer-mgt/h2.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE IF NOT EXISTS SM_SWITCH (
2 | ID INTEGER NOT NULL AUTO_INCREMENT,
3 | OWNER VARCHAR(255) NOT NULL,
4 | DPID VARCHAR(50) NOT NULL,
5 | CREATED_TIME TIMESTAMP NOT NULL,
6 | LAST_UPDATED_TIME TIMESTAMP NOT NULL,
7 | QUOTA INTEGER(8) DEFAULT 0,
8 | BILLING_DAY INTEGER,
9 | BILLING_DATE TIMESTAMP,
10 | STATUS VARCHAR(255) NOT NULL,
11 | UNIQUE (DPID),
12 | PRIMARY KEY (ID),
13 | UNIQUE(DPID));
14 |
15 | CREATE INDEX IF NOT EXISTS SM_SWITCH_ID_INDEX ON SM_SWITCH(OWNER);
16 |
17 | CREATE TABLE IF NOT EXISTS SM_GROUP (
18 | ID INTEGER NOT NULL AUTO_INCREMENT,
19 | GROUP_NAME VARCHAR(100) NOT NULL,
20 | SWITCH_ID INTEGER NOT NULL,
21 | CREATED_TIME TIMESTAMP NOT NULL,
22 | LAST_UPDATED_TIME TIMESTAMP NOT NULL,
23 | QUOTA_APP BOOLEAN NOT NULL DEFAULT FALSE,
24 | PARENTAL_APP BOOLEAN NOT NULL DEFAULT FALSE,
25 | IOT_SECURITY_APP BOOLEAN NOT NULL DEFAULT FALSE,
26 | QUOTA INTEGER(8) DEFAULT 0,
27 | UNIQUE (GROUP_NAME, SWITCH_ID),
28 | FOREIGN KEY (SWITCH_ID) REFERENCES SM_SWITCH(ID),
29 | PRIMARY KEY (ID)
30 | );
31 |
32 | CREATE INDEX IF NOT EXISTS SM_GROUP_ID_INDEX ON SM_GROUP(SWITCH_ID);
33 |
34 | CREATE TABLE IF NOT EXISTS SM_DEVICE (
35 | ID INTEGER NOT NULL AUTO_INCREMENT,
36 | MAC_ADDRESS VARCHAR(50) NOT NULL,
37 | DEVICE_NAME VARCHAR(100) NOT NULL,
38 | CREATED_TIME TIMESTAMP NOT NULL,
39 | LAST_UPDATED_TIME TIMESTAMP NOT NULL,
40 | SWITCH_ID INTEGER NOT NULL,
41 | STATUS VARCHAR(50),
42 | GROUP_ID INTEGER,
43 | PROPERTY TEXT,
44 | UNIQUE (MAC_ADDRESS, SWITCH_ID),
45 | FOREIGN KEY (SWITCH_ID) REFERENCES SM_SWITCH(ID),
46 | PRIMARY KEY (ID));
47 |
48 |
--------------------------------------------------------------------------------
/resources/faucet/conf/faucet.yaml:
--------------------------------------------------------------------------------
1 | include-optional:
2 | - 14cc205133ea-acl-mud.yaml
3 |
4 | dps:
5 | switch-1:
6 | dp_id: 0x14cc205133ea
7 | timeout: 3600
8 | arp_neighbor_timeout: 3600
9 | interfaces:
10 | 1:
11 | native_vlan: 100
12 | acls_in: [mud-mirror-acl,default-allow-acl]
13 | 2:
14 | native_vlan: 100
15 | acls_in: [mud-mirror-acl,default-allow-acl]
16 | 3:
17 | native_vlan: 100
18 | acls_in: [mud-mirror-acl,default-allow-acl]
19 | 5:
20 | output_only: True
21 | 4294967294:
22 | native_vlan: 100
23 |
24 | vlans:
25 | 100:
26 |
27 | acls:
28 | mud-mirror-acl:
29 | - rule:
30 | eth_dst: 'ff:ff:ff:ff:ff:ff'
31 | eth_type: 0x800
32 | ip_proto: 17
33 | udp_dst: 67
34 | actions:
35 | allow: 1
36 | mirror: 5
37 |
38 | default-allow-acl:
39 | - rule:
40 | actions:
41 | allow: 1
--------------------------------------------------------------------------------
/resources/faucet/conf/gauge.yaml:
--------------------------------------------------------------------------------
1 | # Recommended configuration is Prometheus for all monitoring, with all_dps: True
2 | faucet_configs:
3 | - '/etc/faucet/faucet.yaml'
4 | watchers:
5 | port_status_poller:
6 | type: 'port_state'
7 | all_dps: True
8 | #dps: ['sw1', 'sw2']
9 | db: 'influx'
10 | port_stats_poller:
11 | type: 'port_stats'
12 | all_dps: True
13 | #dps: ['sw1', 'sw2']
14 | interval: 60
15 | db: 'influx'
16 | #db: 'influx'
17 | flow_table_poller:
18 | type: 'flow_table'
19 | all_dps: True
20 | interval: 60
21 | db: 'influx'
22 | dbs:
23 | prometheus:
24 | type: 'prometheus'
25 | prometheus_addr: '0.0.0.0'
26 | prometheus_port: 9303
27 | ft_file:
28 | type: 'text'
29 | compress: True
30 | file: 'flow_table.yaml.gz'
31 | influx:
32 | type: 'influx'
33 | influx_db: 'faucet'
34 | influx_host: 'influxdb'
35 | influx_port: 8086
36 | influx_user: 'faucet'
37 | influx_pwd: 'faucet'
38 | influx_timeout: 10
39 |
--------------------------------------------------------------------------------
/resources/faucet/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: '2'
2 | services:
3 | influxdb:
4 | restart: always
5 | image: 'influxdb:1.3-alpine'
6 | ports:
7 | - '8086:8086'
8 | - '8083:8083'
9 | volumes:
10 | - './conf/influxdb:/var/lib/influxdb'
11 | environment:
12 | INFLUXDB_DB: 'faucet'
13 | INFLUXDB_HTTP_AUTH_ENABLED: 'true'
14 | INFLUXDB_ADMIN_USER: 'faucet'
15 | INFLUXDB_ADMIN_PASSWORD: 'faucet'
16 |
17 | # prometheus:
18 | # restart: always
19 | # image: 'prom/prometheus:v2.0.0'
20 | # user: 'root'
21 | # ports:
22 | # - '9090:9090'
23 | # volumes:
24 | # - './conf/prometheus/:/prometheus'
25 | # - './etc/prometheus/prometheus-docker-compose.yml:/etc/prometheus/prometheus.yml'
26 | # - './etc/prometheus/faucet.rules.yml:/etc/prometheus/faucet.rules.yml'
27 | # links:
28 | # - faucet
29 | # - gauge
30 |
31 | # grafana:
32 | # restart: always
33 | # image: 'grafana/grafana:4.5.2'
34 | # ports:
35 | # - '3000:3000'
36 | # volumes:
37 | # - './conf/grafana:/var/lib/grafana'
38 | # links:
39 | # - influxdb
40 | # - prometheus
41 |
42 | gnatsd:
43 | restart: always
44 | image: 'nats:latest'
45 | ports:
46 | - '4222:4222'
47 | - '8222:8222'
48 | - '6222:6222'
49 |
50 | gauge:
51 | restart: always
52 | image: 'faucet/gauge:latest'
53 | environment:
54 | GAUGE_CONFIG: '/etc/faucet/gauge.yaml'
55 | volumes:
56 | - './conf/:/var/log/faucet'
57 | - './conf/:/etc/faucet'
58 | ports:
59 | - '6654:6653'
60 | - '9303'
61 | links:
62 | - influxdb
63 |
64 | faucet:
65 | restart: always
66 | image: 'faucet/faucet:latest'
67 | volumes:
68 | - './conf/:/var/log/faucet'
69 | - './conf/:/etc/faucet'
70 | ports:
71 | - '6653:6653'
72 | - '9302'
73 | environment:
74 | FAUCET_CONFIG_STAT_RELOAD: '1'
75 | FAUCET_EVENT_SOCK: '1'
76 |
77 | faucet_adapter:
78 | restart: always
79 | build:
80 | context: ./extension/
81 | dockerfile: Dockerfile
82 | depends_on:
83 | - faucet
84 | volumes_from:
85 | - faucet
86 | image: 'nats-adapter:faucet'
87 | environment:
88 | FAUCET_EVENT_SOCK: '1'
89 | NATS_URL: 'nats://gnatsd:4222'
90 | links:
91 | - gnatsd
92 |
93 | ryu:
94 | restart: always
95 | build:
96 | context: ./ryu/
97 | dockerfile: Dockerfile
98 | image: 'ryu:faucet'
99 | ports:
100 | - '6655:6653'
101 | environment:
102 | NATS_URL: 'nats://gnatsd:4222'
103 | links:
104 | - gnatsd
105 |
--------------------------------------------------------------------------------
/resources/faucet/etc/default/faucet:
--------------------------------------------------------------------------------
1 | FAUCET_RYU_CONF=/etc/faucet/ryu.conf
2 | FAUCET_LISTEN_PORT=6653
3 | FAUCET_PROMETHEUS_PORT=9302
4 | FAUCET_CONFIG=/etc/faucet/faucet.yaml
5 | FAUCET_LOG=/var/log/faucet/faucet.log
6 | FAUCET_EXCEPTION_LOG=/var/log/faucet/faucet_exception.log
7 |
--------------------------------------------------------------------------------
/resources/faucet/etc/default/gauge:
--------------------------------------------------------------------------------
1 | WSAPI_LISTEN_HOST=localhost
2 | GAUGE_RYU_CONF=/etc/faucet/ryu.conf
3 | GAUGE_LISTEN_PORT=6654
4 | GAUGE_CONFIG=/etc/faucet/gauge.yaml
5 | GAUGE_LOG=/var/log/faucet/gauge.log
6 | GAUGE_EXCEPTION_LOG=/var/log/faucet/gauge_exception.log
7 |
--------------------------------------------------------------------------------
/resources/faucet/etc/faucet/acls.yaml:
--------------------------------------------------------------------------------
1 | acls:
2 | office-vlan-protect:
3 | # Prevent IPv4 communication betwen Office/Guest networks
4 | - rule:
5 | dl_type: 0x800 # ipv4
6 | ipv4_src: 10.0.100.0/24
7 | ipv4_dst: 10.0.200.0/24
8 | actions:
9 | allow: 0 # drop
10 | - rule:
11 | actions:
12 | allow: 1 # allow
13 |
14 | access-port-protect:
15 | # Drop dhcp servers
16 | - rule:
17 | dl_type: 0x800 # ipv4
18 | nw_proto: 17 # udp
19 | udp_src: 67 # bootps
20 | udp_dst: 68 # bootpc
21 | actions:
22 | allow: 0 # drop
23 | # Drop dhcpv6 servers
24 | - rule:
25 | dl_type: 0x86dd # ipv6
26 | nw_proto: 17 # udp
27 | udp_src: 547 # dhcpv6-server
28 | udp_dst: 546 # dhcpv6-client
29 | actions:
30 | allow: 0 # drop
31 | # Drop icmpv6 RAs
32 | - rule:
33 | dl_type: 0x86dd # ipv6
34 | nw_proto: 58 # icmpv6
35 | icmpv6_type: 134 # router advertisement
36 | actions:
37 | allow: 0 # drop
38 | # Drop SMTP
39 | - rule:
40 | dl_type: 0x800 # ipv4
41 | nw_proto: 6 # tcp
42 | tcp_dst: 25 # smtp
43 | actions:
44 | allow: 0 # drop
45 | # Force DNS to our DNS server
46 | - rule:
47 | dl_type: 0x800 # ipv4
48 | nw_proto: 17 # udp
49 | udp_dst: 53 # dns
50 | actions:
51 | output:
52 | dl_dst: "72:b8:3c:4c:dc:4d"
53 | port: 5 # s1 container
54 | # Force DNS to our DNS server
55 | - rule:
56 | dl_type: 0x800 # ipv4
57 | nw_proto: 6 # tcp
58 | tcp_dst: 53 # dns
59 | actions:
60 | output:
61 | dl_dst: "72:b8:3c:4c:dc:4d"
62 | port: 5 # s1 container
63 | - rule:
64 | actions:
65 | allow: 1 # allow
66 |
67 | service-port-protect:
68 | # Drop icmpv6 RAs
69 | - rule:
70 | dl_type: 0x86dd # ipv6
71 | nw_proto: 58 # icmpv6
72 | icmpv6_type: 134 # router advertisement
73 | actions:
74 | allow: 0 # drop
75 | # Drop SMTP
76 | - rule:
77 | dl_type: 0x800 # ipv4
78 | nw_proto: 6 # tcp
79 | tcp_dst: 25 # smtp
80 | actions:
81 | allow: 0 # drop
82 | - rule:
83 | actions:
84 | allow: 1 # allow
85 |
--------------------------------------------------------------------------------
/resources/faucet/etc/faucet/faucet.yaml:
--------------------------------------------------------------------------------
1 | include:
2 | - acls.yaml
3 |
4 | vlans:
5 | office:
6 | vid: 100
7 | description: "office network"
8 | acls_in: [office-vlan-protect]
9 | faucet_mac: "0e:00:00:00:10:01"
10 | faucet_vips: ['10.0.100.254/24', '2001:100::1/64', 'fe80::c00:00ff:fe00:1001/64']
11 | routes:
12 | - route:
13 | ip_dst: '192.168.0.0/24'
14 | ip_gw: '10.0.100.2'
15 | guest:
16 | vid: 200
17 | description: "guest network"
18 | faucet_mac: "0e:00:00:00:20:01"
19 | faucet_vips: ['10.0.200.254/24', '2001:200::1/64', 'fe80::c00:00ff:fe00:2001/64']
20 |
21 | routers:
22 | router-office-guest:
23 | vlans: [office, guest]
24 |
25 | dps:
26 | sw1:
27 | dp_id: 0x1
28 | hardware: "Open vSwitch"
29 | proactive_learn: True
30 | interfaces:
31 | 1:
32 | name: "h1"
33 | description: "host1 container"
34 | native_vlan: office
35 | acls_in: [access-port-protect]
36 | 2:
37 | name: "h2"
38 | description: "host2 container"
39 | native_vlan: office
40 | acls_in: [access-port-protect]
41 | 3:
42 | name: "g1"
43 | description: "guest1 container"
44 | native_vlan: guest
45 | acls_in: [access-port-protect]
46 | 4:
47 | name: "s1"
48 | description: "services1 container"
49 | native_vlan: office
50 | acls_in: [service-port-protect]
51 | 5:
52 | name: "trunk"
53 | description: "VLAN trunk to sw2"
54 | tagged_vlans: [office]
55 | acls_in: [access-port-protect]
56 | sw2:
57 | dp_id: 0x2
58 | hardware: "Allied-Telesis"
59 | interfaces:
60 | 1:
61 | name: "pi"
62 | description: "Raspberry Pi"
63 | native_vlan: office
64 | acls_in: [access-port-protect]
65 | 2:
66 | name: "laptop"
67 | description: "Guest Laptop"
68 | native_vlan: guest
69 | acls_in: [access-port-protect]
70 | 24:
71 | name: "trunk"
72 | description: "VLAN trunk to sw1"
73 | tagged_vlans: [office, guest]
74 |
--------------------------------------------------------------------------------
/resources/faucet/etc/faucet/gauge.yaml:
--------------------------------------------------------------------------------
1 | # Recommended configuration is Prometheus for all monitoring, with all_dps: True
2 | faucet_configs:
3 | - '/etc/faucet/faucet.yaml'
4 | watchers:
5 | port_status_poller:
6 | type: 'port_state'
7 | all_dps: True
8 | #dps: ['sw1', 'sw2']
9 | db: 'prometheus'
10 | port_stats_poller:
11 | type: 'port_stats'
12 | all_dps: True
13 | #dps: ['sw1', 'sw2']
14 | interval: 10
15 | db: 'prometheus'
16 | #db: 'influx'
17 | flow_table_poller:
18 | type: 'flow_table'
19 | all_dps: True
20 | interval: 60
21 | db: 'prometheus'
22 | dbs:
23 | prometheus:
24 | type: 'prometheus'
25 | prometheus_addr: '0.0.0.0'
26 | prometheus_port: 9303
27 | ft_file:
28 | type: 'text'
29 | compress: True
30 | file: 'flow_table.yaml.gz'
31 | influx:
32 | type: 'influx'
33 | influx_db: 'faucet'
34 | influx_host: 'influxdb'
35 | influx_port: 8086
36 | influx_user: 'faucet'
37 | influx_pwd: 'faucet'
38 | influx_timeout: 10
39 |
--------------------------------------------------------------------------------
/resources/faucet/etc/faucet/ofproto_to_ryu.json:
--------------------------------------------------------------------------------
1 | {
2 | "tables" : {
3 | "OFPTFPT_INSTRUCTIONS": {
4 | "name" : "OFPTableFeaturePropInstructions",
5 | "action_tag" : "instruction_ids"
6 | },
7 | "OFPTFPT_INSTRUCTIONS_MISS": {
8 | "name" : "OFPTableFeaturePropInstructions",
9 | "action_tag" : "instruction_ids"
10 | },
11 | "OFPTFPT_NEXT_TABLES": {
12 | "name" : "OFPTableFeaturePropNextTables",
13 | "action_tag" : "table_ids"
14 | },
15 | "OFPTFPT_NEXT_TABLES_MISS": {
16 | "name" : "OFPTableFeaturePropNextTables",
17 | "action_tag" : "table_ids"
18 | },
19 | "OFPTFPT_WRITE_ACTIONS": {
20 | "name" : "OFPTableFeaturePropActions",
21 | "action_tag" : "action_ids"
22 | },
23 | "OFPTFPT_WRITE_ACTIONS_MISS": {
24 | "name" : "OFPTableFeaturePropActions",
25 | "action_tag" : "action_ids"
26 | },
27 | "OFPTFPT_APPLY_ACTIONS": {
28 | "name" : "OFPTableFeaturePropActions",
29 | "action_tag" : "action_ids"
30 | },
31 | "OFPTFPT_APPLY_ACTIONS_MISS": {
32 | "name" : "OFPTableFeaturePropActions",
33 | "action_tag" : "action_ids"
34 | },
35 | "OFPTFPT_MATCH": {
36 | "name" : "OFPTableFeaturePropOxm",
37 | "action_tag" : "oxm_ids"
38 | },
39 | "OFPTFPT_WILDCARDS": {
40 | "name" : "OFPTableFeaturePropOxm",
41 | "action_tag" : "oxm_ids"
42 | },
43 | "OFPTFPT_WRITE_SETFIELD": {
44 | "name" : "OFPTableFeaturePropOxm",
45 | "action_tag" : "oxm_ids"
46 | },
47 | "OFPTFPT_WRITE_SETFIELD_MISS": {
48 | "name" : "OFPTableFeaturePropOxm",
49 | "action_tag" : "oxm_ids"
50 | },
51 | "OFPTFPT_APPLY_SETFIELD": {
52 | "name" : "OFPTableFeaturePropOxm",
53 | "action_tag" : "oxm_ids"
54 | },
55 | "OFPTFPT_APPLY_SETFIELD_MISS": {
56 | "name" : "OFPTableFeaturePropOxm",
57 | "action_tag" : "oxm_ids"
58 | }
59 | },
60 | "content" : {
61 | "instruction_ids": "OFPInstructionId",
62 | "table_ids": [],
63 | "action_ids": "OFPActionId",
64 | "oxm_ids": "OFPOxmId"
65 | },
66 | "table_tag": "OFPTableFeaturesStats"
67 | }
68 |
--------------------------------------------------------------------------------
/resources/faucet/etc/faucet/ryu.conf:
--------------------------------------------------------------------------------
1 | # Requires Ryu 4.0 or above, and allows quick detection of a down OpenFlow channel.
2 | # This file configures core Ryu framework behavior and is required for FAUCET
3 | # to reliably detect and handle loss of OpenFlow switch connection.
4 | [DEFAULT]
5 | echo_request_interval=3
6 | maximum_unreplied_echo_requests=5
7 |
8 | #ofp-tcp-listen-port=6653
9 |
10 | ## wsapi_host=
11 | ## wsapi_port=
12 | ## ofp_listen_host=
13 |
--------------------------------------------------------------------------------
/resources/faucet/etc/logrotate.d/faucet:
--------------------------------------------------------------------------------
1 | /var/log/faucet/faucet.log {
2 | weekly
3 | rotate 14
4 | compress
5 | delaycompress
6 | notifempty
7 | missingok
8 | }
9 |
10 | /var/log/faucet/faucet_exception.log {
11 | weekly
12 | rotate 14
13 | compress
14 | delaycompress
15 | notifempty
16 | missingok
17 | }
18 |
--------------------------------------------------------------------------------
/resources/faucet/etc/logrotate.d/gauge:
--------------------------------------------------------------------------------
1 | /var/log/faucet/gauge.log {
2 | weekly
3 | rotate 14
4 | compress
5 | delaycompress
6 | notifempty
7 | missingok
8 | }
9 |
10 | /var/log/faucet/gauge_exception.log {
11 | weekly
12 | rotate 14
13 | compress
14 | delaycompress
15 | notifempty
16 | missingok
17 | }
18 |
--------------------------------------------------------------------------------
/resources/faucet/etc/prometheus/faucet.rules.yml:
--------------------------------------------------------------------------------
1 | groups:
2 | - name: faucet.rules
3 | rules:
4 |
5 | # Convert OF stats to rates
6 | - record: instance_dpid:of_packet_ins:rate1m
7 | expr: rate(of_packet_ins[1m])
8 | - record: instance_dpid:ignored_packet_ins:rate1m
9 | expr: rate(of_ignored_packet_ins[1m])
10 | - record: instance_dpid:of_flowmsgs_sent:rate1m
11 | expr: rate(of_flowmsgs_sent[1m])
12 |
13 | # Sum hosts learned on VLANs
14 | - record: instance:vlan_hosts_learned:sum
15 | expr: sum(vlan_hosts_learned) BY (instance, vlan)
16 | - record: instance:learned_macs:sum
17 | expr: count(count_values("mac", learned_macs != 0) BY (vlan)) BY (vlan)
18 |
19 | # Convert Port stats to rates
20 | - record: instance_port:of_port_rx_packets:rate1m
21 | expr: rate(of_port_rx_packets[1m])
22 | - record: instance_port:of_port_tx_packets:rate1m
23 | expr: rate(of_port_tx_packets[1m])
24 | - record: instance_port:of_port_rx_bits:rate1m
25 | expr: rate(of_port_rx_bytes[1m]) * 8
26 | - record: instance_port:of_port_tx_bits:rate1m
27 | expr: rate(of_port_tx_bytes[1m]) * 8
28 | - record: instance_port:of_port_rx_dropped:rate1m
29 | expr: rate(of_port_rx_dropped[1m])
30 | - record: instance_port:of_port_tx_dropped:rate1m
31 | expr: rate(of_port_tx_dropped[1m])
32 | - record: instance_port:of_port_rx_errors:rate1m
33 | expr: rate(of_port_rx_errors[1m])
34 |
--------------------------------------------------------------------------------
/resources/faucet/etc/prometheus/prometheus-docker-compose.yml:
--------------------------------------------------------------------------------
1 | global:
2 | scrape_interval: 15s
3 | evaluation_interval: 15s
4 | rule_files:
5 | - "faucet.rules.yml"
6 | scrape_configs:
7 | - job_name: 'faucet'
8 | static_configs:
9 | - targets: ['faucet:9302']
10 | - job_name: 'gauge'
11 | static_configs:
12 | - targets: ['gauge:9303']
13 |
--------------------------------------------------------------------------------
/resources/faucet/etc/prometheus/prometheus.yml:
--------------------------------------------------------------------------------
1 | # my global config
2 | global:
3 | scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
4 | evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
5 | # scrape_timeout is set to the global default (10s).
6 |
7 | # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
8 | rule_files:
9 | - "faucet.rules.yml"
10 |
11 | # A scrape configuration containing exactly one endpoint to scrape:
12 | # Here it's Prometheus itself.
13 | scrape_configs:
14 | # The job name is added as a label `job=` to any timeseries scraped from this config.
15 | - job_name: 'prometheus'
16 | static_configs:
17 | - targets: ['localhost:9090']
18 | - job_name: 'faucet'
19 | static_configs:
20 | - targets: ['localhost:9302']
21 | - job_name: 'gauge'
22 | static_configs:
23 | - targets: ['localhost:9303']
24 |
--------------------------------------------------------------------------------
/resources/faucet/etc/systemd/system/faucet.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description="Faucet OpenFlow switch controller"
3 | After=network-online.target
4 | Wants=network-online.target
5 |
6 | [Service]
7 | EnvironmentFile=/etc/default/faucet
8 | User=faucet
9 | Group=faucet
10 | ExecStart=/usr/local/bin/faucet --ryu-config-file=${FAUCET_RYU_CONF} --ryu-ofp-tcp-listen-port=${FAUCET_LISTEN_PORT}
11 | ExecReload=/bin/kill -HUP $MAINPID
12 | Restart=always
13 |
14 | [Install]
15 | WantedBy=multi-user.target
16 |
--------------------------------------------------------------------------------
/resources/faucet/etc/systemd/system/gauge.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description="Gauge OpenFlow statistics controller"
3 | After=network-online.target
4 | Wants=network-online.target
5 |
6 | [Service]
7 | EnvironmentFile=/etc/default/gauge
8 | User=faucet
9 | Group=faucet
10 | ExecStart=/usr/local/bin/gauge --ryu-config-file=${GAUGE_RYU_CONF} --ryu-ofp-tcp-listen-port=${GAUGE_LISTEN_PORT} --ryu-wsapi-host=${WSAPI_LISTEN_HOST} --ryu-app=ryu.app.ofctl_rest
11 | Restart=always
12 |
13 | [Install]
14 | WantedBy=multi-user.target
15 |
--------------------------------------------------------------------------------
/resources/faucet/etc/systemd/system/prometheus.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Prometheus Server
3 | Documentation=https://prometheus.io/docs/introduction/overview/
4 | After=network-online.target
5 |
6 | [Service]
7 | User=faucet
8 | Group=faucet
9 | Restart=on-failure
10 | ExecStart=/usr/local/bin/prometheus \
11 | -config.file=/etc/prometheus/prometheus.yml \
12 | -storage.local.path=/var/lib/prometheus/data
13 |
14 | [Install]
15 | WantedBy=multi-user.target
16 |
--------------------------------------------------------------------------------
/resources/faucet/extension/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM faucet/faucet-base
2 |
3 | ENV PYTHONUNBUFFERED=0
4 |
5 | RUN apk add --update \
6 | python3 \
7 | python3-dev \
8 | py3-pip \
9 | gcc \
10 | musl-dev \
11 | && rm -rf /var/cache/apk/*
12 |
13 | WORKDIR /src
14 |
15 | COPY requirements.txt requirements.txt
16 | RUN pip3 install -r requirements.txt
17 |
18 | COPY nats_adapter.py nats_adapter.py
19 | COPY nats_client.py nats_client.py
20 |
21 | CMD ["python3", "nats_adapter.py"]
--------------------------------------------------------------------------------
/resources/faucet/extension/nats_adapter.py:
--------------------------------------------------------------------------------
1 |
2 | import errno
3 | import os
4 | import select
5 | import socket
6 | import sys
7 | from threading import Thread
8 | from nats_client import NatsClient
9 | import time
10 |
11 | def get_sys_prefix():
12 | """This was copied from faucet.valve_util.
13 | Returns an additional prefix for log and configuration files when used in
14 | a virtual environment"""
15 |
16 | # Find the appropriate prefix for config and log file default locations
17 | # in case Faucet is run in a virtual environment. virtualenv marks the
18 | # original path in sys.real_prefix. If this value exists, and is
19 | # different from sys.prefix, then we are most likely running in a
20 | # virtualenv. Also check for Py3.3+ pyvenv.
21 | sysprefix = ''
22 | if (getattr(sys, 'real_prefix', sys.prefix) != sys.prefix or
23 | getattr(sys, 'base_prefix', sys.prefix) != sys.prefix):
24 | sysprefix = sys.prefix
25 |
26 | return sysprefix
27 |
28 | class NatsAdapter():
29 | def __init__(self, *args, **kwargs):
30 | super(NatsAdapter, self).__init__()
31 |
32 | self.event_sock = os.getenv('FAUCET_EVENT_SOCK', '0')
33 | # setup socket
34 | self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
35 |
36 |
37 | def socket_conn(self):
38 | """Make connection to sock to receive events"""
39 | # check if socket events are enabled
40 | if self.event_sock == '0':
41 | print('Not connecting to any socket, FA_EVENT_SOCK is none.')
42 | return False
43 | if self.event_sock == '1':
44 | self.event_sock = get_sys_prefix() + '/var/run/faucet/faucet.sock'
45 | # otherwise it's a path
46 |
47 | #waitng for faucet to initialize
48 | time.sleep(10)
49 | # create connection to unix socket
50 | try:
51 | self.sock.connect(self.event_sock)
52 | except socket.error as err:
53 | print("Failed to connect to the socket because: %s" % err)
54 | return False
55 | print("Connected to the socket at %s" % self.event_sock)
56 | return True
57 |
58 |
59 | def initialize_faucet_event_listener(self):
60 | """Make connections to sock and nats and receive messages from sock
61 | to sent to nats
62 | """
63 | # ensure connections to the socket and nats before getting messages
64 | if self.socket_conn():
65 | # get events from socket
66 | self.sock.setblocking(0)
67 | recv_data = True
68 | buffer = b''
69 | while recv_data:
70 | if not buffer:
71 | read_ready, _, _ = select.select([self.sock], [], [])
72 | if self.sock in read_ready:
73 | continue_recv = True
74 | while continue_recv:
75 | try:
76 | buffer += self.sock.recv(1024)
77 | except socket.error as err:
78 | if err.errno != errno.EWOULDBLOCK:
79 | recv_data = False
80 | continue_recv = False
81 | # send events to rabbit
82 | try:
83 | nats_client = NatsClient();
84 | buffers = buffer.strip().split(b'\n')
85 | for buff in buffers:
86 | nats_client.publish("faucet.sock.stream", buff)
87 | buffer = b''
88 | except Exception as err:
89 | print("Unable to send event to NATS because: %s" % err)
90 | sys.stdout.flush()
91 | self.sock.close()
92 |
93 | if __name__ == "__main__": # pragma: no cover
94 | NATS_ADAPTER = NatsAdapter()
95 | NATS_ADAPTER.initialize_faucet_event_listener()
96 |
--------------------------------------------------------------------------------
/resources/faucet/extension/nats_client.py:
--------------------------------------------------------------------------------
1 | import os
2 | import asyncio
3 | import signal
4 | import time
5 | import sys
6 | import ast
7 | import functools
8 | from nats.aio.client import Client as NATS
9 |
10 | class NatsClient:
11 | def __init__(self):
12 | self.url = os.getenv('NATS_URL')
13 |
14 | def connect_and_subscribe(self, loop):
15 | if not self.url:
16 | print('Not connecting to any NATS server, host is None.')
17 | return
18 |
19 | servers = [self.url]
20 | options = {
21 | "io_loop": loop,
22 | "servers": servers,
23 | }
24 | is_connected = False
25 | while(not is_connected):
26 | try:
27 | client = NATS()
28 | yield from client.connect(**options)
29 | is_connected = True
30 | except Exception as e:
31 | print("failed to connect..retrying " + self.url)
32 | time.sleep(1)
33 | pass
34 |
35 | def signal_handler(signal):
36 | if client.is_closed:
37 | return
38 | print("Disconnecting...")
39 | loop.create_task(client.close())
40 |
41 | for sig in ('SIGINT', 'SIGTERM'):
42 | loop.add_signal_handler(getattr(signal, sig), signal_handler)
43 |
44 | @asyncio.coroutine
45 | def subscribe_handler(msg):
46 | subject = msg.subject
47 | reply = msg.reply
48 | data = msg.data.decode()
49 | print("Received a message on '{subject} {reply}': {data}".format(
50 | subject=subject, reply=reply, data=data))
51 |
52 | print("subscribing to faucet.msg topic");
53 | yield from client.subscribe("faucet.msg", cb=subscribe_handler)
54 |
55 | def subscribe(self):
56 | asyncio.set_event_loop(asyncio.new_event_loop())
57 | loop = asyncio.get_event_loop()
58 | loop.run_until_complete(self.connect_and_subscribe(loop))
59 | try:
60 | loop.run_forever()
61 | finally:
62 | loop.close()
63 |
64 | def publish_msg(self, subject, msg, loop):
65 | client = NATS()
66 | servers = [self.url]
67 | options = {
68 | "io_loop": loop,
69 | "servers": servers,
70 | }
71 | try:
72 | yield from client.connect(**options)
73 | yield from client.publish(subject, msg)
74 | yield from client.flush()
75 | yield from client.close()
76 | except Exception as e:
77 | print(e)
78 | pass
79 |
80 | def publish(self, subject, msg):
81 | asyncio.set_event_loop(asyncio.new_event_loop())
82 | loop = asyncio.get_event_loop()
83 | try:
84 | loop.run_until_complete(self.publish_msg(subject, msg, loop))
85 | finally:
86 | loop.close()
87 |
--------------------------------------------------------------------------------
/resources/faucet/extension/requirements.txt:
--------------------------------------------------------------------------------
1 | asyncio-nats-client
2 |
--------------------------------------------------------------------------------
/resources/faucet/ryu/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM faucet/faucet-python3
2 |
3 | ENV PYTHONUNBUFFERED=0
4 |
5 | RUN apk add --update \
6 | python3 \
7 | python3-dev \
8 | py3-pip \
9 | gcc \
10 | musl-dev \
11 | && rm -rf /var/cache/apk/*
12 |
13 | WORKDIR /home/ryu-extension
14 |
15 | COPY requirements.txt requirements.txt
16 | RUN pip3 install -r requirements.txt
17 |
18 | COPY nats_adapter.py nats_adapter.py
19 | COPY nats_client.py nats_client.py
20 |
21 | CMD ["ryu-manager", "/home/ryu-extension/nats_adapter.py"]
--------------------------------------------------------------------------------
/resources/faucet/ryu/nats_adapter.py:
--------------------------------------------------------------------------------
1 | import errno
2 | import os
3 | import select
4 | import socket
5 | import sys
6 | from threading import Thread
7 | from ryu.base import app_manager
8 | from ryu.controller import dpset
9 | from ryu.controller import ofp_event
10 | from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
11 | from ryu.controller.handler import set_ev_cls
12 | from nats_client import NatsClient
13 | import time
14 |
15 | def get_sys_prefix():
16 | """This was copied from faucet.valve_util.
17 | Returns an additional prefix for log and configuration files when used in
18 | a virtual environment"""
19 |
20 | # Find the appropriate prefix for config and log file default locations
21 | # in case Faucet is run in a virtual environment. virtualenv marks the
22 | # original path in sys.real_prefix. If this value exists, and is
23 | # different from sys.prefix, then we are most likely running in a
24 | # virtualenv. Also check for Py3.3+ pyvenv.
25 | sysprefix = ''
26 | if (getattr(sys, 'real_prefix', sys.prefix) != sys.prefix or
27 | getattr(sys, 'base_prefix', sys.prefix) != sys.prefix):
28 | sysprefix = sys.prefix
29 |
30 | return sysprefix
31 |
32 | class NatsAdapter(app_manager.RyuApp):
33 | _CONTEXTS = {
34 | 'dpset': dpset.DPSet
35 | }
36 |
37 | def __init__(self, *args, **kwargs):
38 | super(NatsAdapter, self).__init__(*args, **kwargs)
39 | dpset = kwargs['dpset']
40 | subscriber = NatsClient(self.logger,dpset);
41 | subscriberThread = Thread(target=subscriber.subscribe)
42 | subscriberThread.start()
43 |
44 | #This should not handle any packet in, if there is any packets are sent then push a rule to forward those packets.
45 | # @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
46 | # def packetin_handler(self, ev):
47 | # datapath = ev.msg.datapath
48 | # ofproto = datapath.ofproto
49 | # parser = datapath.ofproto_parser
50 | # match = parser.OFPMatch()
51 | # actions = [parser.OFPActionOutput(ofproto.OFPP_NORMAL, 0)]
52 | # self.add_flow(datapath, match, actions)
53 |
54 |
55 | # def add_flow(self, datapath, match, act,table_id = 0, priority=1, idle_timeout=0,hard_timeout=0):
56 | # ofproto = datapath.ofproto
57 | # parser = datapath.ofproto_parser
58 | # inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS, act)]
59 | # mod = parser.OFPFlowMod(datapath=datapath,table_id=table_id, cookie = 7730494, command = ofproto.OFPFC_ADD, priority=priority,
60 | # match=match, instructions=inst, idle_timeout=idle_timeout, hard_timeout=hard_timeout)
61 | # datapath.send_msg(mod)
62 |
--------------------------------------------------------------------------------
/resources/faucet/ryu/nats_client.py:
--------------------------------------------------------------------------------
1 | import os
2 | import asyncio
3 | import signal
4 | import time
5 | import sys
6 | import ast
7 | import functools
8 | from nats.aio.client import Client as NATS
9 | from ryu.exception import RyuException
10 | from ryu.ofproto import ofproto_v1_0
11 | from ryu.ofproto import ofproto_v1_2
12 | from ryu.ofproto import ofproto_v1_3
13 | from ryu.ofproto import ofproto_v1_4
14 | from ryu.ofproto import ofproto_v1_5
15 | from ryu.lib import ofctl_v1_0
16 | from ryu.lib import ofctl_v1_2
17 | from ryu.lib import ofctl_v1_3
18 | from ryu.lib import ofctl_v1_4
19 | from ryu.lib import ofctl_v1_5
20 |
21 | supported_ofctl = {
22 | ofproto_v1_0.OFP_VERSION: ofctl_v1_0,
23 | ofproto_v1_2.OFP_VERSION: ofctl_v1_2,
24 | ofproto_v1_3.OFP_VERSION: ofctl_v1_3,
25 | ofproto_v1_4.OFP_VERSION: ofctl_v1_4,
26 | ofproto_v1_5.OFP_VERSION: ofctl_v1_5,
27 | }
28 |
29 | class NatsClient:
30 | def __init__(self, logger, dpid_set = None):
31 | self.url = os.getenv('NATS_URL')
32 | if dpid_set is not None:
33 | self.dpset = dpid_set;
34 | self.logger = logger
35 |
36 | def connect_and_subscribe(self, loop):
37 | if not self.url:
38 | self.logger.error('Not connecting to any NATS server, host is None.')
39 | return
40 |
41 | servers = [self.url]
42 | options = {
43 | "io_loop": loop,
44 | "servers": servers,
45 | }
46 | is_connected = False
47 | while(not is_connected):
48 | try:
49 | client = NATS()
50 | yield from client.connect(**options)
51 | is_connected = True
52 | except Exception as e:
53 | self.logger.error("failed to connect..retrying " + self.url)
54 | time.sleep(1)
55 | pass
56 |
57 | def signal_handler(signal):
58 | if client.is_closed:
59 | return
60 | self.logger.info("Disconnecting...")
61 | loop.create_task(client.close())
62 |
63 | for sig in ('SIGINT', 'SIGTERM'):
64 | loop.add_signal_handler(getattr(signal, sig), signal_handler)
65 |
66 | @asyncio.coroutine
67 | def subscribe_handler(msg):
68 | subject = msg.subject
69 | reply = msg.reply
70 | data = msg.data.decode()
71 | self.logger.debug("Received a message on '{subject} {reply}': {data}".format(
72 | subject=subject, reply=reply, data=data))
73 | try:
74 | body = ast.literal_eval(data)
75 | dpid = body.get('dpid', None)
76 | if not dpid:
77 | self.logger.error("dpid is not found in " + body)
78 | return
79 | dp = self.dpset.get(dpid)
80 | if dp is None:
81 | self.logger.error('No such Datapath: %s', dpid)
82 | return
83 | # Get lib/ofctl_* module
84 | try:
85 | ofctl = supported_ofctl.get(dp.ofproto.OFP_VERSION)
86 | ofctl.mod_flow_entry(dp, body, dp.ofproto.OFPFC_ADD)
87 | except KeyError:
88 | self.logger.error('Unsupported OF version: version=%s', dp.ofproto.OFP_VERSION)
89 | except Exception as e:
90 | self.logger.error(e)
91 |
92 | self.logger.info("subscribing to faucet.msg topic");
93 | yield from client.subscribe("faucet.msg", cb=subscribe_handler)
94 |
95 | def subscribe(self):
96 | asyncio.set_event_loop(asyncio.new_event_loop())
97 | loop = asyncio.get_event_loop()
98 | loop.run_until_complete(self.connect_and_subscribe(loop))
99 | try:
100 | loop.run_forever()
101 | finally:
102 | loop.close()
103 |
104 | def publish_msg(self, subject, msg, loop):
105 | client = NATS()
106 | servers = [self.url]
107 | options = {
108 | "io_loop": loop,
109 | "servers": servers,
110 | }
111 | try:
112 | yield from client.connect(**options)
113 | yield from client.publish(subject, msg)
114 | yield from client.flush()
115 | yield from client.close()
116 | except Exception as e:
117 | self.logger.error(e)
118 | pass
119 |
120 | def publish(self, subject, msg):
121 | asyncio.set_event_loop(asyncio.new_event_loop())
122 | loop = asyncio.get_event_loop()
123 | try:
124 | loop.run_until_complete(self.publish_msg(subject, msg, loop))
125 | finally:
126 | loop.close()
127 |
--------------------------------------------------------------------------------
/resources/faucet/ryu/requirements.txt:
--------------------------------------------------------------------------------
1 | asyncio-nats-client
2 | ryu==4.23
--------------------------------------------------------------------------------
/resources/mud-collector/conf/deployment.yml:
--------------------------------------------------------------------------------
1 | server:
2 |
3 | requestLog:
4 | appenders: []
5 | # - type: console
6 | # layout:
7 | # type: access-json
8 | # timestampFormat: "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
9 | # requestHeaders:
10 | # - User-Agent
11 | # - X-Request-Id
12 |
13 | applicationConnectors:
14 | - type: http
15 | port: 9005
16 | # - type: https
17 | # port: 8443
18 | # keyStorePath: keystores/seer.jks
19 | # keyStorePassword: seer
20 | # keyStoreType: JKS
21 |
22 | adminConnectors:
23 | - type: http
24 | port: 9006
25 | # - type: https
26 | # port: 8444
27 | # keyStorePath: keystores/seer.jks
28 | # keyStorePassword: seer
29 | # keyStoreType: JKS
30 | # trustStorePath: /path/to/file
31 | # trustStorePassword: changeit
32 | # trustStoreType: JKS
33 |
34 | controller:
35 | type: faucet
36 | # hostname: ${CTR_HOSTNAME:-localhost}
37 | # port: ${CTR_PORT:-8080}
38 | hostname: localhost
39 | port: 4222
40 | properties:
41 | username: "faucet"
42 | password: "faucet"
43 | dbName: "faucet"
44 | dbUrl: "http://localhost:8086"
45 | mode: "collector"
46 |
47 | logging:
48 | level: ERROR
49 | loggers:
50 | com.mudie: INFO
51 | # feign: DEBUG
52 | appenders:
53 | - type: console
54 | threshold: INFO
55 | - type: file
56 | currentLogFilename: logs/mud-ie.log
57 | logFormat: "%-6level [%d{HH:mm:ss.SSS}] [%t] %logger{5} - %X{code} %msg %n"
58 | threshold: INFO
59 | archive: true
60 | archivedLogFilenamePattern: logs/mud-ie-%d{yyyy-MM-dd}-%i.log
61 | archivedFileCount: 10
62 | timeZone: UTC
63 | maxFileSize: 10Mb
64 |
65 |
66 | mudConfig:
67 | mudPacketLogging: true
68 | mudReactiveIdleTimeout: 7200
69 | summerizationTimeInSeconds: 60
70 | mudControllers:
71 | - id: "urn:ietf:params:mud:dns"
72 | value: "192.168.1.1"
73 | - id: "urn:ietf:params:mud:ntp"
74 | value: "192.168.1.1"
75 | - id: "urn:ietf:params:mud:gateway"
76 | value: "192.168.1.1"
77 |
78 | switches:
79 | - "14cc205133ea"
80 |
81 | swagger: True
82 |
--------------------------------------------------------------------------------
/resources/mud-collector/datasources/seer-mgt.properties:
--------------------------------------------------------------------------------
1 | jndiName=seer_mgt
2 | jdbcUrl=jdbc:h2:../inspector-engine/database/SeerMgt;DB_CLOSE_ON_EXIT=FALSE;AUTO_SERVER=TRUE
3 | dataSource.user=seer
4 | dataSource.password=seer
5 |
--------------------------------------------------------------------------------