Coder Social home page Coder Social logo

ncl427 / ibn-manager Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 2.0 3.97 MB

Intent Based Networking Manager for KOREN SmartX Open Platform Project

License: MIT License

JavaScript 1.60% CSS 19.73% Groovy 72.25% Shell 2.61% Batchfile 1.33% TSQL 2.48%
intent networking onos

ibn-manager's Introduction

Project Title

Intent Based Networking Manager (IBN Manager)

ALT text

Introduction

Intent Based Networking Manager is a module for SD-ACCESS slicing on the KOREN SmartX Open Platform. IBN Manager can be used to send Host to Host intent to SDN(ONOS) Controller. IBN Manager also can be used to send Point to Point Intent to SDN(ONOS) Controller.

This application (remotely) will interact with ONOS controller via REST and install flows to handle real time traffic.

  • Make intents according to their policies
  • Compile intents into json format
  • Send them to ONOS controller
  • Maintain database for each intent
  • Provide functionality to delete intent specific to mac address

Host To Host intent ONOS

Host to Host intent provide the simple connectivity intent which enables the connectivity between two hosts. Host to Host intent has been compiled to two path intents with the appropriate traffic selections and actions computed on your behalf. Host to Host Intent is based on Mac + VlanId. For example 0E:6A:50:E7:45:89/-1. It identifies the shortest path b/w two endpoints and installs flows in the appropriate switches.

{ 
    "type": "HostToHostIntent", 
    "appId": "org.onosproject.cli",  
    "priority": 55, 
    "one": "FE:1D:3D:05:BB:71/-1",
    "two": "AB:16:24:91:CC:45/-1"
 }

ALT text

Point To Point intent ONOS

In Point To Point Intent, we have to specify the device info as well where the flow should be installed. Point to Point intent gives a fine grained control on the path for example: forward all input pkts with specific Ip s/d to a predefined out port for all the switches on the path.

{ 
    "type": "PointToPointIntent", 
    "appId": "org.onosproject.cli",  
    "priority": 100, 
    "selector": {
   	"criteria": [ 
	      {
		"type": "ETH_SRC",
		"mac": "FE:1D:3D:05:BB:71"
	      }
	]
     },
    "ingressPoint": { 
        "device": "of:0000000000000001", 
        "port": "3" 
    }, 
    "egressPoint":  {
        "device": "of:0000000000000001", 
        "port": "2" 
    } 
 }

ALT text

Project Structure

This application is based on MVC development architecture using Grails 3 framework. Grails 3 framework is used Gradle as build automation system.

grails-app

Most of the things that we will write will reside in the grails-app folder. This is where our Grails specific code will reside and it follows certain conventions.

ALT text

  1. Assets folder

    • This is where we will put most of our static files that we will refer in our HTML code.
    • It will usually contain files for JavaScript, CSS, images, and others.
  2. Conf folder: The conf folder is where the configuration files resides.

    • resources.groovy - Grails sits on top of the Spring framework. If we wish to define additional Spring objects, we can put it here.
    • application.yml - This is the main configuration file and most of the settings goes here.
    • logback.groovy - This is the configuration file for logging
  3. Controllers folder

    • The controllers folder contains controller classes. If we need to create controllers, the corresponding classes generated will go here.
    • Core business logic of each view is implement here.
    • By default, UrlMappings.groovy is also created in this folder. This is the file where we can control how requests, depending on url format, direct to which controller or resource.
  4. Views folder

    • The views folder contains GSP files. This is the equivalent of Java's JSP files in Grails framework.
    • This is where we put HTML related code to be rendered and shown to users.
    • Each controller will have a corresponding folder with the same name (without the controller suffix and the first letter is not capitalized).
    • There is a special folder named layouts where templates are placed. Templates are special GSP files that we can use to avoid repetitive code. This is where we will place our web design layout. The important thing is it should contain the <g:layoutBody/> tag.
  5. Domain folder

    • This is where we will put Groovy classes that corresponds to a table in a database.
  6. Services folder

    • Controllers are the entry point of interaction with users. But it is not good practice to put business code inside controllers. We usually place them in services, and we invoke those services inside controllers.
  7. Taglib folder

    • Grails provide taglib is how easy it which is helpful for creating a custom tag easily. This folder is where we place code for custom tags.
  8. i8n folder

    • This is the folder that contains resources for translation. By default, lookups to messages are searched in messages.properties.
    • But when users of your application has chosen a different locale, then lookups will automatically search the appropriate file. E.g. messages_ja.properties for Japanese.
  9. Init folder

    • This contains files related to when your application is launched.
    • Application.groovy is a convenience class that we can use inside an IDE to launch our Grails 3 application. Because IDE's usually has a way to run a program that has a main static method. Hence this class is provided to launch our application via main method.

Source Folder

The source folder contains supporting code that we can use in our Grails project:

  • integration-test - this will contain integration test codes
  • main/groovy - we can write any Groovy classes here that we can use inside controllers, etc. E.g. utility classes.
  • test - this will contain unit test codes

Build Process

Many modern web frameworks in the Java space are more complicated than needed and don’t embrace the Don’t Repeat Yourself (DRY) principles. Grails is a full stack framework and attempts to solve as many pieces of the web development puzzle through the core technology and its associated plugins.

Installation Requirements

Before installing Grails 3.3.6 you will need as a minimum a Java Development Kit (JDK) installed version 1.7 or above. Download the appropriate JDK for your operating system, run the installer, and then set up an environment variable called JAVA_HOME pointing to the location of this installation.

JAVA_HOME=/path/to/Java/jdk
PATH=%JAVA_HOME/bin%

Downloading and Installing

The first step to getting up and running with Grails is to install the distribution. MySQL database is required as a external database.

Download MySQL Installer

Grails Manual installation

  • Download a binary distribution of Grails and extract the resulting zip file to a location of your choice
  • Set the GRAILS_HOME environment variable to the location where you extracted the zip
GRAILS_HOME=/path/to/grails
PATH=%GRAILS_HOME/bin%

If Grails is working correctly you should now be able to type grails -version in the terminal window and see output similar to this:

Grails version: 3.3.6

IDE

Download

You can clone/download project from here. https://github.com/ncl427/IBN-Manager

ibn-manager's People

Contributors

adeel86 avatar ncl427 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

fandash adeel86

ibn-manager's Issues

Getting null pointer exception, when trying to create intent (Path, Slice) & Host To Host Intent

Cannot invoke method getHeaders() on null object

Error 500: Internal Server Error
URI
/pointToPointIntent/save
Class
java.lang.NullPointerException
Message
null
Caused by
Cannot invoke method getHeaders() on null object
Around line 57 of grails-app\controllers\ibn\manager\PointToPointIntentController.groovy
54: else
55: response = clientONOS.createSlicingIntent(pointToPointIntent)
56:
57: pointToPointIntent.intentKey = response.getHeaders().getLocation().toString().split("/")[response.getHeaders().getLocation().toString().split("/").length-1]
58:
59: pointToPointIntentService.save(pointToPointIntent)
60:
Trace
Line | Method
->> 211 | invoke in org.grails.core.DefaultGrailsControllerClass$ReflectionInvoker


| 188 | invoke in org.grails.core.DefaultGrailsControllerClass
| 90 | handle . . . . . in org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter
| 967 | doDispatch in org.springframework.web.servlet.DispatcherServlet
| 901 | doService . . . in ''
| 970 | processRequest in org.springframework.web.servlet.FrameworkServlet
| 872 | doPost . . . . . in ''
| 846 | service in ''
| 55 | doFilterInternal in org.springframework.boot.web.filter.ApplicationContextHeaderFilter
| 77 | doFilterInternal in org.grails.web.servlet.mvc.GrailsWebRequestFilter
| 67 | doFilterInternal in org.grails.web.filters.HiddenHttpMethodFilter
| 1149 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 624 | run . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 748 | run in java.lang.Thread

Caused by NullPointerException: Cannot invoke method getHeaders() on null object
->> 57 | save in PointToPointIntentController.groovy


| 211 | invoke in org.grails.core.DefaultGrailsControllerClass$ReflectionInvoker
| 188 | invoke . . . . . in org.grails.core.DefaultGrailsControllerClass
| 90 | handle in org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter
| 967 | doDispatch . . . in org.springframework.web.servlet.DispatcherServlet
| 901 | doService in ''
| 970 | processRequest . in org.springframework.web.servlet.FrameworkServlet
| 872 | doPost in ''
| 846 | service . . . . in ''
| 55 | doFilterInternal in org.springframework.boot.web.filter.ApplicationContextHeaderFilter
| 77 | doFilterInternal in org.grails.web.servlet.mvc.GrailsWebRequestFilter
| 67 | doFilterInternal in org.grails.web.filters.HiddenHttpMethodFilter
| 1149 | runWorker . . . in java.util.concurrent.ThreadPoolExecutor
| 624 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 748 | run . . . . . . in java.lang.Thread

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.