Merge commit '3587426b0f9786b7aa101cd67a4c46a3d1769c2e' into feature/serviceTopology
diff --git a/views/ngXosLib/README.md b/views/ngXosLib/README.md
new file mode 100644
index 0000000..0166efd
--- /dev/null
+++ b/views/ngXosLib/README.md
@@ -0,0 +1,101 @@
+# ngXosLib
+
+This is a collection of helpers to develop views as Angular SPA.
+
+## Tools
+
+This tools are designed to help you developing UI for XOS. As they born for this purpose if often necessary that a XOS instance is running on your sistem and responding at: `localhost:9999`. The `xos/configurations/frontend` is normally enough.
+
+### Apigen
+
+Usage: `npm run apigen`
+
+This tool will automatically generate an angular resource file for each endpoint available in Swagger.
+
+>You can generate api related documentation with: `npm run apidoc`. The output is locate in `api/docs`. You can have a list of available method also trough Swagger at `http://localhost:9999/docs/`
+
+### Vendors
+
+Xos comes with a preset of common libraries, as listed in `bower.json`:
+- angular
+- angular-route
+- angular-resource
+- angular-cookie
+- ng-lodash
+
+This libraries are server through Django, so they will not be included in your minified vendor file. To add a library and generate a new file (that will override the old one), you should:
+- enter `ngXosLib` folder
+- run `bower install [myPackage] --save`
+- rebuild the file with `gulp vendor`
+
+>_NOTE before adding libraries please discuss it to avoid this file to became huge_
+
+### Helpers
+
+XOS comes with an helper library that is automatically loaded in the Django template.
+
+To use it, add `xos.helpers` to your required modules:
+
+```
+angular.module('xos.myView', [
+  'xos.helpers'
+])
+```
+
+It will automatically ad a `token` to all your request, eventually you can take advantage of some other services:
+
+- **NoHyperlinks Interceptor**: will add a `?no_hyperlinks=1` to your request, to tell Django to return ids instead of links.
+- **XosApi** wrapper for `/xos` endpoints.
+- **XoslibApi** wrapper for `/xoslib` endpoints.
+- **HpcApi** wrapper for `/hpcapi` endpoints.
+
+>_NOTE: for the API related service, check documentation in [Apigen](#apigen) section._
+
+### Yo Xos
+
+We have created a [yeoman](http://yeoman.io/) generator to help you scaffolding views.
+
+>As it is in an early stage of development you should manually link it to your system, to do this enter `xos/core/xoslib/ngXosLib/generator-xos` and run `npm link`.
+
+#### To generate a new view
+
+From `xos/core/xoslib` run `yo xos`. This command will create a new folder with the provided name in: `xos/core/xoslib/ngXosViews` that contain your application.
+
+>If you left empty the view name it should be `xos/core/xoslib/ngXosViews/sampleView`
+
+#### Run a development server
+
+In your `view` folder and run `npm start`.
+
+_This will install required dependencies and start a local server with [BrowserSync](http://www.browsersync.io/)_
+
+#### Publish your view
+
+Once your view is done, from your view root folder, run: `npm run build`.
+
+This will build your application and copy files in the appropriate locations to be used by django.
+
+At this point you can enter: `http://localhost:9999/admin/core/dashboardview/add/` and add your custom view.
+
+>_NOTE url field should be `template:xosSampleView`_
+
+#### Install dependencies in your app
+
+To install a local dependency use bower with `--save`. Common modules are saved in `devDependencies` as they already loaded in the Django template.
+
+The `npm start` command is watching your dependencies and will automatically inject it in your `index.html`.
+
+#### Linting
+
+A styleguide is enforced trough [EsLint](http://eslint.org/) and is checked during the build process. We **highly** suggest to install the linter in your editor to have realtime hint.
+
+#### Test
+
+The generator set up a test environment with a default test.
+To run it execute: `npm test`
+
+## TODO
+
+- Use Angular $resource instead of $http
+- Use ngDoc instead of jsDoc
+- Define styleguide (both visual and js) and if needed define some UI components
\ No newline at end of file
diff --git a/views/ngXosLib/xosHelpers/src/services/csrfToken.interceptor.js b/views/ngXosLib/xosHelpers/src/services/csrfToken.interceptor.js
index 025813c..283e90d 100644
--- a/views/ngXosLib/xosHelpers/src/services/csrfToken.interceptor.js
+++ b/views/ngXosLib/xosHelpers/src/services/csrfToken.interceptor.js
@@ -1,18 +1,18 @@
 (function() {
-  'use strict';
+    'use strict';
 
-  angular
-    .module('xos.helpers')
-    .factory('SetCSRFToken', setCSRFToken);
+    angular
+        .module('xos.helpers')
+        .factory('SetCSRFToken', setCSRFToken);
 
-  function setCSRFToken($cookies) {
-    return {
-      request: function(request){
-        if(request.method !== 'GET'){
-          request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
+    function setCSRFToken($cookies) {
+      return {
+        request: function(request){
+          if(request.method !== 'GET'){
+            request.headers['X-CSRFToken'] = $cookies.get('xoscsrftoken');
+          }
+          return request;
         }
-        return request;
-      }
-    };
-  }
+      };
+    }
 })();
diff --git a/views/ngXosViews/.gitignore b/views/ngXosViews/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/views/ngXosViews/.gitignore
diff --git a/views/ngXosViews/ceilometerDashboard/src/js/main.js b/views/ngXosViews/ceilometerDashboard/src/js/main.js
index a20d563..04ab3e8 100644
--- a/views/ngXosViews/ceilometerDashboard/src/js/main.js
+++ b/views/ngXosViews/ceilometerDashboard/src/js/main.js
@@ -91,12 +91,10 @@
     templateUrl: 'templates/ceilometer-dashboard.tpl.html',
     controller: function(Ceilometer){
 
-      console.log(Ceilometer.selectedService, Ceilometer.selectedSlice, Ceilometer.selectedResource);
-
       // this open the accordion
       this.accordion = {
         open: {}
-      }
+      };
 
       /**
       * Open the active panel base on the service stored values
@@ -328,6 +326,7 @@
     }
   }
 })
+  // NOTE reading this on demand for a single
 .directive('ceilometerStats', function(){
   return {
     restrict: 'E',
diff --git a/views/ngXosViews/serviceTopology/.bowerrc b/views/ngXosViews/serviceTopology/.bowerrc
new file mode 100644
index 0000000..e491038
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/.bowerrc
@@ -0,0 +1,3 @@
+{
+  "directory": "src/vendor/"
+}
\ No newline at end of file
diff --git a/views/ngXosViews/serviceTopology/.eslintrc b/views/ngXosViews/serviceTopology/.eslintrc
new file mode 100644
index 0000000..c852748
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/.eslintrc
@@ -0,0 +1,42 @@
+{
+    "ecmaFeatures": {
+        "blockBindings": true,
+        "forOf": true,
+        "destructuring": true,
+        "arrowFunctions": true,
+        "templateStrings": true
+    },
+    "env": { 
+        "browser": true,
+        "node": true,
+        "es6": true
+    },
+    "plugins": [
+        //"angular"
+    ],
+    "rules": {
+        "quotes": [2, "single"],
+        "camelcase": [1, {"properties": "always"}],
+        "no-underscore-dangle": 1,
+        "eqeqeq": [2, "smart"],
+        "no-alert": 1,
+        "key-spacing": [1, { "beforeColon": false, "afterColon": true }],
+        "indent": [2, 2],
+        "no-irregular-whitespace": 1,
+        "eol-last": 0,
+        "max-nested-callbacks": [2, 4],
+        "comma-spacing": [1, {"before": false, "after": true}],
+        "no-trailing-spaces": [1, { skipBlankLines: true }],
+        "no-unused-vars": [1, {"vars": "all", "args": "after-used"}],
+        "new-cap": 0,
+
+        //"angular/ng_module_name": [2, '/^xos\.*[a-z]*$/'],
+        //"angular/ng_controller_name": [2, '/^[a-z].*Ctrl$/'],
+        //"angular/ng_service_name": [2, '/^[A-Z].*Service$/'],
+        //"angular/ng_directive_name": [2, '/^[a-z]+[[A-Z].*]*$/'],
+        //"angular/ng_di": [0, "function or array"]
+    },
+    "globals" :{
+        "angular": true
+    } 
+}
\ No newline at end of file
diff --git a/views/ngXosViews/serviceTopology/.gitignore b/views/ngXosViews/serviceTopology/.gitignore
new file mode 100644
index 0000000..567aee4
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/.gitignore
@@ -0,0 +1,6 @@
+dist/
+src/vendor
+.tmp
+node_modules
+npm-debug.log
+dist/
\ No newline at end of file
diff --git a/views/ngXosViews/serviceTopology/bower.json b/views/ngXosViews/serviceTopology/bower.json
new file mode 100644
index 0000000..edf419d
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/bower.json
@@ -0,0 +1,32 @@
+{
+  "name": "xos-serviceTopology",
+  "version": "0.0.0",
+  "authors": [
+    "Matteo Scandolo <teo@onlab.us>"
+  ],
+  "description": "The serviceTopology view",
+  "license": "MIT",
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "bower_components",
+    "static/js/vendor/",
+    "test",
+    "tests"
+  ],
+  "dependencies": {
+    "d3": "~3.5.13",
+    "lodash": "~4.0.0",
+    "angular-animate": "~1.4.9"
+  },
+  "devDependencies": {
+    "jquery": "~2.1.4",
+    "angular-mocks": "~1.4.7",
+    "angular": "~1.4.7",
+    "angular-ui-router": "~0.2.15",
+    "angular-cookies": "~1.4.7",
+    "angular-resource": "~1.4.7",
+    "ng-lodash": "~0.3.0",
+    "bootstrap-css": "~3.3.6"
+  }
+}
diff --git a/views/ngXosViews/serviceTopology/env/apt.js b/views/ngXosViews/serviceTopology/env/apt.js
new file mode 100644
index 0000000..47c3e95
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/env/apt.js
@@ -0,0 +1,13 @@
+// This is a default configuration for your development environment.
+// You can duplicate this configuration for any of your Backend Environments.
+// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
+// `NODE_ENV=local npm start`
+//
+// If xoscsrftoken or xossessionid are not specified the browser value are used
+// (works only for local environment as both application are served on the same domain)
+
+module.exports = {
+  host: 'http://apt045.apt.emulab.net:9999/',
+  xoscsrftoken: '56kxBxMtXeSJavUkqhgaAEXuSmi2snMy',
+  xossessionid: 'pffs71hhko88moqpa7mjxz1jrh9bklpb	'
+};
diff --git a/views/ngXosViews/serviceTopology/env/default.js b/views/ngXosViews/serviceTopology/env/default.js
new file mode 100644
index 0000000..9d8f108
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/env/default.js
@@ -0,0 +1,13 @@
+// This is a default configuration for your development environment.
+// You can duplicate this configuration for any of your Backend Environments.
+// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
+// `NODE_ENV=local npm start`
+//
+// If xoscsrftoken or xossessionid are not specified the browser value are used
+// (works only for local environment as both application are served on the same domain)
+
+module.exports = {
+  host: 'http://clnode078.clemson.cloudlab.us:9999/',
+  xoscsrftoken: 'kJlAS4O3AJOpLq2fMkhor2QKLaWvxSAd',
+  xossessionid: 'f7z75zly6omm9ftlswsujfe87hfaomn2'
+};
diff --git a/views/ngXosViews/serviceTopology/env/srikanth.js b/views/ngXosViews/serviceTopology/env/srikanth.js
new file mode 100644
index 0000000..1cef3bd
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/env/srikanth.js
@@ -0,0 +1,13 @@
+// This is a default configuration for your development environment.
+// You can duplicate this configuration for any of your Backend Environments.
+// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
+// `NODE_ENV=local npm start`
+//
+// If xoscsrftoken or xossessionid are not specified the browser value are used
+// (works only for local environment as both application are served on the same domain)
+
+module.exports = {
+  host: 'http://130.127.133.41:9999',
+  xoscsrftoken: 'RfURkVJbCMk6xQPPlNrtPwfD3PXADExp',
+  xossessionid: 'dkar580x0b0z14vz9j198s1ns0m6g3cb'
+};
diff --git a/views/ngXosViews/serviceTopology/gulp/build.js b/views/ngXosViews/serviceTopology/gulp/build.js
new file mode 100644
index 0000000..ecf9ed3
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/gulp/build.js
@@ -0,0 +1,118 @@
+'use strict';
+
+// BUILD
+//
+// The only purpose of this gulpfile is to build a XOS view and copy the correct files into
+// .html => dashboards
+// .js (minified and concat) => static/js
+//
+// The template are parsed and added to js with angular $templateCache
+
+var gulp = require('gulp');
+var ngAnnotate = require('gulp-ng-annotate');
+var uglify = require('gulp-uglify');
+var templateCache = require('gulp-angular-templatecache');
+var runSequence = require('run-sequence');
+var concat = require('gulp-concat');
+var del = require('del');
+var wiredep = require('wiredep');
+var angularFilesort = require('gulp-angular-filesort');
+var _ = require('lodash');
+var eslint = require('gulp-eslint');
+var inject = require('gulp-inject');
+var rename = require('gulp-rename');
+var replace = require('gulp-replace');
+
+var TEMPLATE_FOOTER = `}]);
+angular.module('xos.serviceTopology').run(function($location){$location.path('/')});
+angular.bootstrap(angular.element('#xosServiceTopology'), ['xos.serviceTopology']);`;
+
+module.exports = function(options){
+  
+  // delete previous builded file
+  gulp.task('clean', function(){
+    return del(
+      [options.dashboards + 'xosServiceTopology.html'],
+      {force: true}
+    );
+  });
+
+  // compile and minify scripts
+  gulp.task('scripts', function() {
+    return gulp.src([
+      options.tmp + '**/*.js'
+    ])
+    .pipe(ngAnnotate())
+    .pipe(angularFilesort())
+    .pipe(concat('xosServiceTopology.js'))
+    .pipe(uglify())
+    .pipe(gulp.dest(options.static + 'js/'));
+  });
+
+  // set templates in cache
+  gulp.task('templates', function(){
+    return gulp.src('./src/templates/*.html')
+      .pipe(templateCache({
+        module: 'xos.serviceTopology',
+        root: 'templates/',
+        templateFooter: TEMPLATE_FOOTER
+      }))
+      .pipe(gulp.dest(options.tmp));
+  });
+
+  // copy html index to Django Folder
+  gulp.task('copyHtml', ['clean'], function(){
+    return gulp.src(options.src + 'index.html')
+      // remove dev dependencies from html
+      .pipe(replace(/<!-- bower:css -->(\n.*)*\n<!-- endbower --><!-- endcss -->/, ''))
+      .pipe(replace(/<!-- bower:js -->(\n.*)*\n<!-- endbower --><!-- endjs -->/, ''))
+      .pipe(replace(/ng-app=".*"\s/, ''))
+      // injecting minified files
+      .pipe(
+        inject(
+          gulp.src([
+            options.static + 'js/vendor/xosServiceTopologyVendor.js',
+            options.static + 'js/xosServiceTopology.js'
+          ])
+        )
+      )
+      .pipe(rename('xosServiceTopology.html'))
+      .pipe(gulp.dest(options.dashboards));
+  });
+
+  // minify vendor js files
+  gulp.task('wiredep', function(){
+    var bowerDeps = wiredep().js;
+    if(!bowerDeps){
+      return;
+    }
+
+    // remove angular (it's already loaded)
+    _.remove(bowerDeps, function(dep){
+      return dep.indexOf('angular/angular.js') !== -1;
+    });
+
+    return gulp.src(bowerDeps)
+      .pipe(concat('xosServiceTopologyVendor.js'))
+      .pipe(uglify())
+      .pipe(gulp.dest(options.static + 'js/vendor/'));
+  });
+
+  gulp.task('lint', function () {
+    return gulp.src(['src/js/**/*.js'])
+      .pipe(eslint())
+      .pipe(eslint.format())
+      .pipe(eslint.failAfterError());
+  });
+
+  gulp.task('build', function() {
+    runSequence(
+      'templates',
+      'babel',
+      'scripts',
+      'wiredep',
+      'copyHtml',
+      'cleanTmp'
+    );
+  });
+};
\ No newline at end of file
diff --git a/views/ngXosViews/serviceTopology/gulp/server.js b/views/ngXosViews/serviceTopology/gulp/server.js
new file mode 100644
index 0000000..7605294
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/gulp/server.js
@@ -0,0 +1,146 @@
+'use strict';
+
+var gulp = require('gulp');
+var browserSync = require('browser-sync').create();
+var inject = require('gulp-inject');
+var runSequence = require('run-sequence');
+var angularFilesort = require('gulp-angular-filesort');
+var babel = require('gulp-babel');
+var wiredep = require('wiredep').stream;
+var httpProxy = require('http-proxy');
+var del = require('del');
+
+const environment = process.env.NODE_ENV;
+
+if (environment){
+  var conf = require(`../env/${environment}.js`);
+}
+else{
+  var conf = require('../env/default.js')
+}
+
+var proxy = httpProxy.createProxyServer({
+  target: conf.host || 'http://0.0.0.0:9999'
+});
+
+
+proxy.on('error', function(error, req, res) {
+  res.writeHead(500, {
+    'Content-Type': 'text/plain'
+  });
+
+  console.error('[Proxy]', error);
+});
+
+module.exports = function(options){
+
+  // open in browser with sync and proxy to 0.0.0.0
+  gulp.task('browser', function() {
+    browserSync.init({
+      // reloadDelay: 500,
+      // logLevel: 'debug',
+      // logConnections: true,
+      startPath: '#/',
+      snippetOptions: {
+        rule: {
+          match: /<!-- browserSync -->/i
+        }
+      },
+      server: {
+        baseDir: options.src,
+        routes: {
+          '/api': options.api,
+          '/xosHelpers/src': options.helpers
+        },
+        middleware: function(req, res, next){
+          if(
+            req.url.indexOf('/xos/') !== -1 ||
+            req.url.indexOf('/xoslib/') !== -1 ||
+            req.url.indexOf('/hpcapi/') !== -1
+          ){
+            if(conf.xoscsrftoken && conf.xossessionid){
+              req.headers.cookie = `xoscsrftoken=${conf.xoscsrftoken}; xossessionid=${conf.xossessionid}`;
+              req.headers['x-csrftoken'] = conf.xoscsrftoken;
+            }
+            proxy.web(req, res);
+          }
+          else{
+            next();
+          }
+        }
+      }
+    });
+
+    gulp.watch(options.src + 'js/**/*.js', ['js-watch']);
+    gulp.watch(options.src + 'vendor/**/*.js', ['bower'], function(){
+      browserSync.reload();
+    });
+    gulp.watch(options.src + '**/*.html', function(){
+      browserSync.reload();
+    });
+  });
+
+  // transpile js with sourceMaps
+  gulp.task('babel', function(){
+    return gulp.src(options.scripts + '**/*.js')
+      .pipe(babel({sourceMaps: true}))
+      .pipe(gulp.dest(options.tmp));
+  });
+
+  // inject scripts
+  gulp.task('injectScript', ['cleanTmp', 'babel'], function(){
+    return gulp.src(options.src + 'index.html')
+      .pipe(
+        inject(
+          gulp.src([
+            options.tmp + '**/*.js',
+            options.api + '*.js',
+            options.helpers + '**/*.js'
+          ])
+          .pipe(angularFilesort()),
+          {
+            ignorePath: [options.src, '/../../ngXosLib']
+          }
+        )
+      )
+      .pipe(gulp.dest(options.src));
+  });
+
+  // inject CSS
+  gulp.task('injectCss', function(){
+    return gulp.src(options.src + 'index.html')
+      .pipe(
+        inject(
+          gulp.src(options.src + 'css/*.css'),
+          {
+            ignorePath: [options.src]
+          }
+          )
+        )
+      .pipe(gulp.dest(options.src));
+  });
+
+  // inject bower dependencies with wiredep
+  gulp.task('bower', function () {
+    return gulp.src(options.src + 'index.html')
+    .pipe(wiredep({devDependencies: true}))
+    .pipe(gulp.dest(options.src));
+  });
+
+  gulp.task('js-watch', ['injectScript'], function(){
+    browserSync.reload();
+  });
+
+  gulp.task('cleanTmp', function(){
+    return del([options.tmp + '**/*']);
+  });
+
+  gulp.task('serve', function() {
+    runSequence(
+      'bower',
+      'injectScript',
+      'injectCss',
+      ['browser']
+    );
+  });
+};
diff --git a/views/ngXosViews/serviceTopology/gulpfile.js b/views/ngXosViews/serviceTopology/gulpfile.js
new file mode 100644
index 0000000..b2cdab8
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/gulpfile.js
@@ -0,0 +1,24 @@
+'use strict';
+
+var gulp = require('gulp');
+var wrench = require('wrench');
+
+var options = {
+  src: 'src/',
+  scripts: 'src/js/',
+  tmp: 'src/.tmp',
+  dist: 'dist/',
+  api: '../../ngXosLib/api/',
+  helpers: '../../ngXosLib/xosHelpers/src/',
+  static: '../../../xos/core/xoslib/static/', // this is the django static folder
+  dashboards: '../../../xos/core/xoslib/dashboards/' // this is the django html folder
+};
+
+wrench.readdirSyncRecursive('./gulp')
+.map(function(file) {
+  require('./gulp/' + file)(options);
+});
+
+gulp.task('default', function () {
+  gulp.start('build');
+});
diff --git a/views/ngXosViews/serviceTopology/karma.conf.js b/views/ngXosViews/serviceTopology/karma.conf.js
new file mode 100644
index 0000000..5e312fa
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/karma.conf.js
@@ -0,0 +1,90 @@
+// Karma configuration
+// Generated on Tue Oct 06 2015 09:27:10 GMT+0000 (UTC)
+
+/* eslint indent: [2,2], quotes: [2, "single"]*/
+
+/*eslint-disable*/
+var wiredep = require('wiredep');
+var path = require('path');
+
+var bowerComponents = wiredep( {devDependencies: true} )[ 'js' ].map(function( file ){
+  return path.relative(process.cwd(), file);
+});
+
+module.exports = function(config) {
+/*eslint-enable*/
+  config.set({
+
+    // base path that will be used to resolve all patterns (eg. files, exclude)
+    basePath: '',
+
+
+    // frameworks to use
+    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+    frameworks: ['jasmine'],
+
+
+    // list of files / patterns to load in the browser
+    files: bowerComponents.concat([
+      '../../../xos/core/xoslib/static/js/vendor/ngXosVendor.js',
+      '../../../xos/core/xoslib/static/js/vendor/ngXosHelpers.js',
+      '../../../xos/core/xoslib/static/js/xosApi.js',
+      'src/js/main.js',
+      'src/js/**/*.js',
+      'spec/**/*.mock.js',
+      'spec/**/*.test.js',
+      'src/**/*.html'
+    ]),
+
+
+    // list of files to exclude
+    exclude: [
+    ],
+
+
+    // preprocess matching files before serving them to the browser
+    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
+    preprocessors: {
+      'src/js/**/*.js': ['babel'],
+      'spec/**/*.test.js': ['babel'],
+      'src/**/*.html': ['ng-html2js']
+    },
+
+    ngHtml2JsPreprocessor: {
+      stripPrefix: 'src/', //strip the src path from template url (http://stackoverflow.com/questions/22869668/karma-unexpected-request-when-testing-angular-directive-even-with-ng-html2js)
+      moduleName: 'templates' // define the template module name
+    },
+
+    // test results reporter to use
+    // possible values: 'dots', 'progress'
+    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+    reporters: ['mocha'],
+
+
+    // web server port
+    port: 9876,
+
+
+    // enable / disable colors in the output (reporters and logs)
+    colors: true,
+
+
+    // level of logging
+    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+    logLevel: config.LOG_INFO,
+
+
+    // enable / disable watching file and executing tests whenever any file changes
+    autoWatch: true,
+
+
+    // start these browsers
+    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+    browsers: ['PhantomJS'],
+
+
+    // Continuous Integration mode
+    // if true, Karma captures browsers, runs the tests and exits
+    singleRun: false
+  });
+};
diff --git a/views/ngXosViews/serviceTopology/package.json b/views/ngXosViews/serviceTopology/package.json
new file mode 100644
index 0000000..f77d454
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/package.json
@@ -0,0 +1,57 @@
+{
+  "name": "xos-serviceTopology",
+  "version": "1.0.0",
+  "description": "Angular Application for XOS, created with generator-xos",
+  "scripts": {
+    "prestart": "npm install && bower install",
+    "start": "gulp serve",
+    "prebuild": "npm install && bower install",
+    "build": "gulp",
+    "test": "karma start",
+    "lint": "eslint src/js/"
+  },
+  "keywords": [
+    "XOS",
+    "Angular",
+    "XOSlib"
+  ],
+  "author": "Matteo Scandolo",
+  "license": "MIT",
+  "dependencies": {},
+  "devDependencies": {
+    "browser-sync": "^2.9.11",
+    "del": "^2.0.2",
+    "eslint": "^1.8.0",
+    "eslint-plugin-angular": "linkmesrl/eslint-plugin-angular",
+    "gulp": "^3.9.0",
+    "gulp-angular-filesort": "^1.1.1",
+    "gulp-angular-templatecache": "^1.8.0",
+    "gulp-babel": "^5.3.0",
+    "gulp-concat": "^2.6.0",
+    "gulp-eslint": "^1.0.0",
+    "gulp-inject": "^3.0.0",
+    "gulp-minify-html": "^1.0.4",
+    "gulp-ng-annotate": "^1.1.0",
+    "gulp-rename": "^1.2.2",
+    "gulp-replace": "^0.5.4",
+    "gulp-uglify": "^1.4.2",
+    "http-proxy": "^1.12.0",
+    "jasmine-core": "^2.4.1",
+    "karma-jasmine": "^0.3.6",
+    "lodash": "^3.10.1",
+    "proxy-middleware": "^0.15.0",
+    "run-sequence": "^1.1.4",
+    "wiredep": "^3.0.0-beta",
+    "wrench": "^1.5.8",
+    "phantomjs": "^1.9.19",
+    "ink-docstrap": "^0.5.2",
+    "jasmine-core": "~2.3.4",
+    "karma": "^0.13.14",
+    "karma-babel-preprocessor": "~5.2.2",
+    "karma-coverage": "^0.5.3",
+    "karma-jasmine": "~0.3.6",
+    "karma-mocha-reporter": "~1.1.1",
+    "karma-ng-html2js-preprocessor": "^0.2.0",
+    "karma-phantomjs-launcher": "~0.2.1"
+  }
+}
diff --git a/views/ngXosViews/serviceTopology/spec/sample.test.js b/views/ngXosViews/serviceTopology/spec/sample.test.js
new file mode 100644
index 0000000..56f7c8b
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/spec/sample.test.js
@@ -0,0 +1,208 @@
+'use strict';
+
+describe('The Service Relation Service', () => {
+  
+  var Service;
+
+  beforeEach(module('xos.serviceTopology'));
+  beforeEach(module('templates'));
+
+  // inject the cartService
+  beforeEach(inject(function (_ServiceRelation_) {
+    // The injector unwraps the underscores (_) from around the parameter names when matching
+    Service = _ServiceRelation_;
+  }));
+
+  describe('given a service', () => {
+
+    const levelRelations = [
+      {
+        subscriber_service: 1
+      },
+      {
+        subscriber_service: 1
+      },
+      {
+        subscriber_service: 2
+      }
+    ];
+
+    it('should find all involved relations', () => {
+      expect(typeof Service.findLevelRelation).toBe('function');
+      let levelRelation = Service.findLevelRelation(levelRelations, 1);
+      expect(levelRelation.length).toBe(2);
+    });
+  });
+
+  describe('given a set of relation', () => {
+
+    const levelRelations = [
+      {
+        provider_service: 1,
+        service_specific_attribute: '{"instance_id": "instance1"}',
+        subscriber_tenant: 2
+      },
+      {
+        provider_service: 2
+      }
+    ];
+
+    const services = [
+      {
+        id: 1
+      },
+      {
+        id: 2
+      },
+      {
+        id: 3
+      }
+    ];
+
+    it('should find all the provider service', () => {
+      expect(typeof Service.findLevelServices).toBe('function');
+      let levelServices = Service.findLevelServices(levelRelations, services);
+      expect(levelServices.length).toBe(2);
+    });
+
+    it('should retrieve all service specific information', () => {
+      let info = Service.findSpecificInformation(levelRelations, 1);
+      expect(info.instance_id).toBe('instance1');
+    });
+  });
+
+
+
+  describe('given a list of services and a list of relations', () => {
+
+    const services = [
+      {
+        id: 1,
+        humanReadableName: 'service-1'
+      },
+      {
+        id: 2,
+        humanReadableName: 'service-2'
+      },
+      {
+        id: 3,
+        humanReadableName: 'service-3'
+      },
+      {
+        id: 4,
+        humanReadableName: 'service-4'
+      }
+    ];
+
+    const relations = [
+      {
+        provider_service: 2,
+        subscriber_service: 1,
+      },
+      {
+        provider_service: 3,
+        subscriber_service: 2
+      },
+      {
+        provider_service: 4,
+        subscriber_service: 1
+      },
+      {
+        subscriber_root: 1,
+        provider_service: 1
+      }
+    ];
+
+    it('should return a tree ordered by relations', () => {
+      let tree = Service.buildServiceTree(services, relations);
+
+      expect(tree.name).toBe('fakeSubs');
+      expect(tree.parent).toBeNull();
+      expect(tree.children.length).toBe(1);
+
+      expect(tree.children[0].name).toBe('service-1');
+      expect(tree.children[0].parent).toBeNull();
+      expect(tree.children[0].children.length).toBe(2);
+
+      expect(tree.children[0].children[0].name).toBe('service-2');
+      expect(tree.children[0].children[0].children[0].name).toBe('service-3');
+      expect(tree.children[0].children[0].children[0].children[0].name).toBe('Internet');
+
+      expect(tree.children[0].children[1].name).toBe('service-4');
+      expect(tree.children[0].children[1].children[0].name).toBe('Internet');
+    });
+  });
+
+  describe('given an object', () => {
+
+    const sample = {
+      name: '1',
+      children: [
+        {
+          name: '2',
+          children: [
+            {
+              name: '3'
+            }
+          ]
+        }
+      ]
+    };
+
+    it('should return the depth', () => {
+      expect(Service.depthOf(sample)).toBe(3);
+    });
+  });
+
+  describe('given slices and instances', () => {
+    const slices = [
+      {
+        id: 12,
+        name: 'First'
+      },
+      {
+        id: 13,
+        name: 'Second'
+      }
+    ];
+
+    const instances = [
+      [
+        {
+          humanReadableName: 'first-slice-instance-1',
+          id: 1
+        },
+        {
+          humanReadableName: 'first-slice-instance-2',
+          id: 2
+        }
+      ],
+      [
+        {
+          humanReadableName: 'second-slice-instance',
+          id: 3
+        }
+      ]
+    ];
+
+    const service = {
+      service_specific_attribute: {
+        instance_id: 1
+      }
+    };
+
+    it('should create a tree grouping instances', () => {
+      const res = Service.buildServiceInterfacesTree(service, slices, instances);
+
+      expect(res[0].name).toBe('First');
+      expect(res[0].children[0].name).toBe('first-slice-instance-1');
+      expect(res[0].children[0].active).toBeTruthy();
+      expect(res[0].children[1].name).toBe('first-slice-instance-2');
+
+      expect(res[1].name).toBe('Second');
+      expect(res[1].children[0].name).toBe('second-slice-instance');
+    });
+  });
+
+
+});
\ No newline at end of file
diff --git a/views/ngXosViews/serviceTopology/src/css/dev.css b/views/ngXosViews/serviceTopology/src/css/dev.css
new file mode 100644
index 0000000..7ff2305
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/src/css/dev.css
@@ -0,0 +1,15 @@
+
+html, body {
+  margin: 0;
+  padding: 0;
+  max-height: 100%;
+  height: 100%;
+}
+
+#xosServiceTopology{
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+}
\ No newline at end of file
diff --git a/views/ngXosViews/serviceTopology/src/css/serviceTopology.css b/views/ngXosViews/serviceTopology/src/css/serviceTopology.css
new file mode 100644
index 0000000..283967c
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/src/css/serviceTopology.css
@@ -0,0 +1,162 @@
+service-canvas {
+    height: 100%;
+    width: 100%;
+    display: block;
+}
+
+service-canvas .subscriber-select{
+    z-index: 1000;
+    position: absolute;
+    width: 200px;
+    top: 10px;
+    left: 10px;
+}
+
+service-canvas svg {
+    position: absolute;
+    top: 0;
+}
+
+/* LEGEND */
+
+.legend {
+    fill: #fff;
+    stroke: #ccc;
+    stroke-width: 1px;
+    position: relative;
+}
+
+.legend text {
+    stroke: #000;
+}
+
+.node {
+    cursor: pointer;
+}
+
+.node circle,
+.node rect{
+    fill: #fff;
+    stroke: steelblue;
+    stroke-width: 3px;
+}
+
+.node.subscriber circle,
+.node.internet circle {
+    stroke: #05ffcb;
+}
+
+.node.slice rect {
+    stroke: #b01dff;
+}
+
+.node.instance rect {
+    stroke: #ccc;
+}
+
+.node.instance rect.active {
+    stroke: #ff8b00;
+}
+
+.node rect.slice-detail{
+    fill: #fff;
+    stroke: steelblue;
+    stroke-width: 3px;
+}
+
+.node text {
+    font: 12px sans-serif;
+}
+
+.link {
+    fill: none;
+    stroke: #ccc;
+    stroke-width: 2px;
+}
+
+.link.slice {
+    stroke: rgba(157, 4, 183, 0.29);
+}
+.link.instance{
+    stroke: #ccc;
+}
+
+.link.instance.active{
+    stroke: rgba(255, 138, 0, 0.65);
+}
+
+.service-details{
+    width: 200px;
+    position: absolute;
+    top: 20px;
+    right: 20px;
+}
+
+/* when showing the thing */
+
+.animate.ng-hide-remove {
+    animation:0.5s bounceInRight ease;
+}
+
+/* when hiding the picture */
+.animate.ng-hide-add {
+    animation:0.5s bounceOutRight ease;
+}
+
+/* ANIMATIONS */
+
+@keyframes bounceInRight {
+    from, 60%, 75%, 90%, to {
+        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
+    }
+
+    from {
+        opacity: 0;
+        transform: translate3d(3000px, 0, 0);
+    }
+
+    60% {
+        opacity: 1;
+        transform: translate3d(-25px, 0, 0);
+    }
+
+    75% {
+        transform: translate3d(10px, 0, 0);
+    }
+
+    90% {
+        transform: translate3d(-5px, 0, 0);
+    }
+
+    to {
+        transform: none;
+    }
+}
+
+@keyframes bounceInLeft {
+    from, 60%, 75%, 90%, to {
+        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
+    }
+
+    0% {
+        opacity: 0;
+        transform: translate3d(-3000px, 0, 0);
+    }
+
+    60% {
+        opacity: 1;
+        transform: translate3d(25px, 0, 0);
+    }
+
+    75% {
+        transform: translate3d(-10px, 0, 0);
+    }
+
+    90% {
+        transform: translate3d(5px, 0, 0);
+    }
+
+    to {
+        transform: none;
+    }
+}
\ No newline at end of file
diff --git a/views/ngXosViews/serviceTopology/src/index.html b/views/ngXosViews/serviceTopology/src/index.html
new file mode 100644
index 0000000..d2f95db
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/src/index.html
@@ -0,0 +1,40 @@
+<!-- browserSync -->
+<!-- bower:css -->
+<link rel="stylesheet" href="vendor/bootstrap-css/css/bootstrap.min.css" />
+<!-- endbower --><!-- endcss -->
+<!-- inject:css -->
+<link rel="stylesheet" href="/css/dev.css">
+<link rel="stylesheet" href="/css/serviceTopology.css">
+<!-- endinject -->
+
+<div ng-app="xos.serviceTopology" id="xosServiceTopology">
+    <div ui-view></div>
+</div>
+
+<!-- bower:js -->
+<script src="vendor/d3/d3.js"></script>
+<script src="vendor/lodash/lodash.js"></script>
+<script src="vendor/angular/angular.js"></script>
+<script src="vendor/angular-animate/angular-animate.js"></script>
+<script src="vendor/jquery/dist/jquery.js"></script>
+<script src="vendor/angular-mocks/angular-mocks.js"></script>
+<script src="vendor/angular-ui-router/release/angular-ui-router.js"></script>
+<script src="vendor/angular-cookies/angular-cookies.js"></script>
+<script src="vendor/angular-resource/angular-resource.js"></script>
+<script src="vendor/ng-lodash/build/ng-lodash.js"></script>
+<script src="vendor/bootstrap-css/js/bootstrap.min.js"></script>
+<!-- endbower --><!-- endjs -->
+<!-- inject:js -->
+<script src="/xosHelpers/src/xosHelpers.module.js"></script>
+<script src="/xosHelpers/src/services/noHyperlinks.interceptor.js"></script>
+<script src="/xosHelpers/src/services/csrfToken.interceptor.js"></script>
+<script src="/xosHelpers/src/services/api.services.js"></script>
+<script src="/api/ng-xoslib.js"></script>
+<script src="/api/ng-xos.js"></script>
+<script src="/api/ng-hpcapi.js"></script>
+<script src="/.tmp/main.js"></script>
+<script src="/.tmp/topologyCanvas.js"></script>
+<script src="/.tmp/services.js"></script>
+<script src="/.tmp/d3.js"></script>
+<script src="/.tmp/config.js"></script>
+<!-- endinject -->
diff --git a/views/ngXosViews/serviceTopology/src/js/config.js b/views/ngXosViews/serviceTopology/src/js/config.js
new file mode 100644
index 0000000..347feb9
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/src/js/config.js
@@ -0,0 +1,15 @@
+(function () {
+  'use strict';
+
+  angular.module('xos.serviceTopology')
+  .constant('serviceTopologyConfig', {
+    widthMargin: 100,
+    heightMargin: 30,
+    duration: 750,
+    circle: {
+      radius: 10,
+      selectedRadius: 15
+    }
+  })
+
+}());
\ No newline at end of file
diff --git a/views/ngXosViews/serviceTopology/src/js/d3.js b/views/ngXosViews/serviceTopology/src/js/d3.js
new file mode 100644
index 0000000..4672325
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/src/js/d3.js
@@ -0,0 +1,301 @@
+(function () {
+  'use strict';
+
+  angular.module('xos.serviceTopology')
+    .factory('d3', function($window){
+      return $window.d3;
+    })
+  .service('TreeLayout', function($window, lodash, ServiceRelation, serviceTopologyConfig, Slice, Instances){
+
+    const drawLegend = (svg) => {
+      const legendContainer = svg.append('g')
+        .attr({
+          class: 'legend'
+        });
+
+      legendContainer.append('rect')
+      .attr({
+        transform: d => `translate(10, 80)`,
+        width: 100,
+        height: 100
+      });
+
+      // service
+      const service = legendContainer.append('g')
+      .attr({
+        class: 'node service'
+      });
+
+      service.append('circle')
+      .attr({
+        r: serviceTopologyConfig.circle.radius,
+        transform: d => `translate(30, 100)`
+      });
+
+      service.append('text')
+      .attr({
+        transform: d => `translate(45, 100)`,
+        dy: '.35em'
+      })
+      .text('Service')
+        .style('fill-opacity', 1);
+
+      // slice
+      const slice = legendContainer.append('g')
+        .attr({
+          class: 'node slice'
+        });
+
+      slice.append('rect')
+        .attr({
+          width: 20,
+          height: 20,
+          x: -10,
+          y: -10,
+          transform: d => `translate(30, 130)`
+        });
+
+      slice.append('text')
+        .attr({
+          transform: d => `translate(45, 130)`,
+          dy: '.35em'
+        })
+        .text('Slices')
+        .style('fill-opacity', 1);
+
+      // instance
+      const instance = legendContainer.append('g')
+        .attr({
+          class: 'node instance'
+        });
+
+      instance.append('rect')
+        .attr({
+          width: 20,
+          height: 20,
+          x: -10,
+          y: -10,
+          transform: d => `translate(30, 160)`
+        });
+
+      instance.append('text')
+        .attr({
+          transform: d => `translate(45, 160)`,
+          dy: '.35em'
+        })
+        .text('Instances')
+        .style('fill-opacity', 1);
+    };
+
+    var _svg, _layout, _source;
+
+    var i = 0;
+
+    const getInitialNodePosition = (node, source, direction = 'enter') => {
+      // this is the starting position
+      // TODO if enter use y0 and x0 else x and y
+      // TODO start from the node that has been clicked
+      if(node.parent){
+        if(direction === 'enter' && node.parent.y0 && node.parent.x0){
+          return `translate(${node.parent.y0},${node.parent.x0})`;
+        }
+        return `translate(${node.parent.y},${node.parent.x})`;
+      }
+      return `translate(${source.y0},${source.x0})`;
+    };
+
+    // given a canvas, a layout and a data source, draw a tree layout
+    const updateTree = (svg, layout, source) => {
+
+      //cache data
+      _svg = svg;
+      _layout = layout;
+      _source = source;
+
+      const maxDepth = ServiceRelation.depthOf(source);
+
+      const diagonal = d3.svg.diagonal()
+        .projection(d => [d.y, d.x]);
+
+      // Compute the new tree layout.
+      var nodes = layout.nodes(source).reverse(),
+        links = layout.links(nodes);
+
+      // Normalize for fixed-depth.
+      nodes.forEach(function(d) {
+        // position the child node horizontally
+        const step = (($window.innerWidth - (serviceTopologyConfig.widthMargin * 2)) / maxDepth);
+        d.y = d.depth * step;
+        if(d.type === 'slice' || d.type === 'instance'){
+          d.y = d.depth * step - (step / 2);
+        }
+      });
+
+      // Update the nodes…
+      var node = svg.selectAll('g.node')
+        .data(nodes, function(d) { return d.id || (d.id = ++i); });
+
+      // Enter any new nodes at the parent's previous position.
+      var nodeEnter = node.enter().append('g')
+        .attr({
+          class: d => `node ${d.type}`,
+          transform: d => getInitialNodePosition(d, source)
+        });
+
+      const subscriberNodes = nodeEnter.filter('.subscriber');
+      const internetNodes = nodeEnter.filter('.internet');
+      const serviceNodes = nodeEnter.filter('.service');
+      const instanceNodes = nodeEnter.filter('.instance');
+      const sliceNodes = nodeEnter.filter('.slice');
+
+      subscriberNodes.append('path')
+        .attr({
+          d: 'M20.771,12.364c0,0,0.849-3.51,0-4.699c-0.85-1.189-1.189-1.981-3.058-2.548s-1.188-0.454-2.547-0.396c-1.359,0.057-2.492,0.792-2.492,1.188c0,0-0.849,0.057-1.188,0.397c-0.34,0.34-0.906,1.924-0.906,2.321s0.283,3.058,0.566,3.624l-0.337,0.113c-0.283,3.283,1.132,3.68,1.132,3.68c0.509,3.058,1.019,1.756,1.019,2.548s-0.51,0.51-0.51,0.51s-0.452,1.245-1.584,1.698c-1.132,0.452-7.416,2.886-7.927,3.396c-0.511,0.511-0.453,2.888-0.453,2.888h26.947c0,0,0.059-2.377-0.452-2.888c-0.512-0.511-6.796-2.944-7.928-3.396c-1.132-0.453-1.584-1.698-1.584-1.698s-0.51,0.282-0.51-0.51s0.51,0.51,1.02-2.548c0,0,1.414-0.397,1.132-3.68H20.771z',
+          transform: 'translate(-20, -20)'
+        });
+
+      internetNodes.append('path')
+        .attr({
+          d: 'M209,15a195,195 0 1,0 2,0zm1,0v390m195-195H15M59,90a260,260 0 0,0 302,0 m0,240 a260,260 0 0,0-302,0M195,20a250,250 0 0,0 0,382 m30,0 a250,250 0 0,0 0-382',
+          stroke: '#000',
+          'stroke-width': '20px',
+          fill: 'none',
+          transform: 'translate(-10, -10), scale(0.05)'
+        });
+
+      serviceNodes.append('circle')
+        .attr('r', 1e-6)
+        .style('fill', d => d._children ? 'lightsteelblue' : '#fff')
+        .on('click', serviceClick);
+
+      sliceNodes.append('rect')
+        .attr({
+          width: 20,
+          height: 20,
+          x: -10,
+          y: -10
+        });
+
+      instanceNodes.append('rect')
+        .attr({
+          width: 20,
+          height: 20,
+          x: -10,
+          y: -10,
+          class: d => d.active ?'' : 'active'
+        });
+
+      nodeEnter.append('text')
+        .attr({
+          x: d => d.children ? -serviceTopologyConfig.circle.selectedRadius -3 : serviceTopologyConfig.circle.selectedRadius + 3,
+          dy: '.35em',
+          transform: d => {
+            if (d.children && d.parent){
+              if(d.parent.x < d.x){
+                return 'rotate(-30)';
+              }
+              return 'rotate(30)';
+            }
+          },
+          'text-anchor': d => d.children ? 'end' : 'start'
+        })
+        .text(d => d.name)
+        .style('fill-opacity', 1e-6);
+
+      // Transition nodes to their new position.
+      var nodeUpdate = node.transition()
+        .duration(serviceTopologyConfig.duration)
+        .attr({
+          'transform': d => `translate(${d.y},${d.x})`
+        });
+
+      nodeUpdate.select('circle')
+        .attr('r', d => d.selected ? serviceTopologyConfig.circle.selectedRadius : serviceTopologyConfig.circle.radius)
+        .style('fill', d => d.selected ? 'lightsteelblue' : '#fff');
+
+      nodeUpdate.select('text')
+        .style('fill-opacity', 1);
+
+      // Transition exiting nodes to the parent's new position.
+      var nodeExit = node.exit().transition()
+        .duration(serviceTopologyConfig.duration)
+        .attr({
+          'transform': d => getInitialNodePosition(d, source, 'exit')
+        })
+        .remove();
+
+      nodeExit.select('circle')
+        .attr('r', 1e-6);
+
+      nodeExit.select('text')
+        .style('fill-opacity', 1e-6);
+
+      // Update the links…
+      var link = svg.selectAll('path.link')
+        .data(links, function(d) { return d.target.id; });
+
+      // Enter any new links at the parent's previous position.
+      link.enter().insert('path', 'g')
+        .attr('class', d => `link ${d.target.type} ${d.target.active ? '' : 'active'}`)
+        .attr('d', function(d) {
+          var o = {x: source.x0, y: source.y0};
+          return diagonal({source: o, target: o});
+        });
+
+      // Transition links to their new position.
+      link.transition()
+        .duration(serviceTopologyConfig.duration)
+        .attr('d', diagonal);
+
+      // Transition exiting nodes to the parent's new position.
+      link.exit().transition()
+        .duration(serviceTopologyConfig.duration)
+        .attr('d', function(d) {
+          var o = {x: source.x, y: source.y};
+          return diagonal({source: o, target: o});
+        })
+        .remove();
+
+      // Stash the old positions for transition.
+      nodes.forEach(function(d) {
+        d.x0 = d.x;
+        d.y0 = d.y;
+      });
+    };
+
+    const serviceClick = function(d) {
+
+      if(!d.service){
+        return;
+      }
+
+      // toggling selected status
+      d.selected = !d.selected;
+
+      var selectedNode = d3.select(this);
+
+      selectedNode
+        .transition()
+        .duration(serviceTopologyConfig.duration)
+        .attr('r', serviceTopologyConfig.circle.selectedRadius);
+
+      ServiceRelation.getServiceInterfaces(d.service)
+        .then(interfaceTree => {
+
+          const isDetailed = lodash.find(d.children, {type: 'slice'});
+          if(isDetailed){
+            lodash.remove(d.children, {type: 'slice'});
+          }
+          else {
+            d.children = d.children.concat(interfaceTree);
+          }
+
+          updateTree(_svg, _layout, _source);
+        });
+    };
+
+    this.updateTree = updateTree;
+    this.drawLegend = drawLegend;
+  });
+
+}());
\ No newline at end of file
diff --git a/views/ngXosViews/serviceTopology/src/js/main.js b/views/ngXosViews/serviceTopology/src/js/main.js
new file mode 100644
index 0000000..4e6239a
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/src/js/main.js
@@ -0,0 +1,20 @@
+'use strict';
+
+angular.module('xos.serviceTopology', [
+  'ngResource',
+  'ngCookies',
+  'ngLodash',
+  'ngAnimate',
+  'ui.router',
+  'xos.helpers'
+])
+.config(($stateProvider) => {
+  $stateProvider
+  .state('user-list', {
+    url: '/',
+    template: '<service-canvas></service-canvas>'
+  });
+})
+.config(function($httpProvider){
+  $httpProvider.interceptors.push('NoHyperlinks');
+});
diff --git a/views/ngXosViews/serviceTopology/src/js/services.js b/views/ngXosViews/serviceTopology/src/js/services.js
new file mode 100644
index 0000000..12dedaf
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/src/js/services.js
@@ -0,0 +1,220 @@
+(function () {
+  'use strict';
+
+  angular.module('xos.serviceTopology')
+  .service('Services', function($resource){
+    return $resource('/xos/services/:id', {id: '@id'});
+  })
+  .service('Tenant', function($resource){
+    return $resource('/xos/tenants');
+  })
+  .service('Slice', function($resource){
+    return $resource('/xos/slices', {id: '@id'});
+  })
+  .service('Instances', function($resource){
+    return $resource('/xos/instances', {id: '@id'});
+  })
+  .service('Subscribers', function($resource){
+    return $resource('/xos/subscribers', {id: '@id'});
+  })
+  .service('ServiceRelation', function($q, lodash, Services, Tenant, Slice, Instances){
+
+    // count the mas depth of an object
+    const depthOf = (obj) => {
+      var depth = 0;
+      if (obj.children) {
+        obj.children.forEach(function (d) {
+          var tmpDepth = depthOf(d);
+          if (tmpDepth > depth) {
+            depth = tmpDepth
+          }
+        })
+      }
+      return 1 + depth
+    };
+
+    // find all the relation defined for a given root
+    const findLevelRelation = (tenants, rootId) => {
+      return lodash.filter(tenants, service => {
+        return service.subscriber_service === rootId;
+      });
+    };
+
+    const findSpecificInformation = (tenants, rootId) => {
+      var tenants = lodash.filter(tenants, service => {
+        return service.provider_service === rootId && service.subscriber_tenant;
+      });
+
+      var info;
+
+      tenants.forEach((tenant) => {
+        if(tenant.service_specific_attribute){
+          info = JSON.parse(tenant.service_specific_attribute);
+        }
+      });
+
+      return info;
+    };
+
+    // find all the service defined by a given array of relations
+    const findLevelServices = (relations, services) => {
+      const levelServices = [];
+      lodash.forEach(relations, (tenant) => {
+        var service = lodash.find(services, {id: tenant.provider_service});
+        levelServices.push(service);
+      });
+      return levelServices;
+    };
+
+    const buildLevel = (tenants, services, rootService, parentName = null) => {
+
+      // build an array of unlinked services
+      // these are the services that should still placed in the tree
+      var unlinkedServices = lodash.difference(services, [rootService]);
+
+      // find all relations relative to this rootElement
+      const levelRelation = findLevelRelation(tenants, rootService.id);
+
+      // find all items related to rootElement
+      const levelServices = findLevelServices(levelRelation, services);
+
+      // remove this item from the list (performance
+      unlinkedServices = lodash.difference(unlinkedServices, levelServices);
+
+      rootService.service_specific_attribute = findSpecificInformation(tenants, rootService.id);
+
+      const tree = {
+        name: rootService.humanReadableName,
+        parent: parentName,
+        type: 'service',
+        service: rootService,
+        children: []
+      };
+
+      lodash.forEach(levelServices, (service) => {
+        tree.children.push(buildLevel(tenants, unlinkedServices, service, rootService.humanReadableName));
+      });
+
+      // if it is the last element append internet
+      if(tree.children.length === 0){
+        tree.children.push({
+          name: 'Internet',
+          type: 'internet',
+          children: []
+        });
+      }
+
+      return tree;
+    };
+
+    const buildServiceTree = (services, tenants, subscriber = {id: 1, name: 'fakeSubs'}) => {
+
+      // find the root service
+      // it is the one attached to subsriber_root
+      // as now we have only one root so this can work
+      const rootServiceId = lodash.find(tenants, {subscriber_root: subscriber.id}).provider_service;
+      const rootService = lodash.find(services, {id: rootServiceId});
+
+      const serviceTree = buildLevel(tenants, services, rootService);
+
+      return {
+        name: subscriber.name,
+        parent: null,
+        type: 'subscriber',
+        children: [serviceTree]
+      };
+
+    };
+
+    const get = (subscriber) => {
+      var deferred = $q.defer();
+      var services, tenants;
+      Services.query().$promise
+      .then((res) => {
+        services = res;
+        return Tenant.query().$promise;
+      })
+      .then((res) => {
+        tenants = res;
+        deferred.resolve(buildServiceTree(services, tenants, subscriber));
+      })
+      .catch((e) => {
+        throw new Error(e);
+      });
+
+      return deferred.promise;
+    };
+
+    const buildServiceInterfacesTree = (service, slices, instances) => {
+
+      const isActive = (service, instance) => {
+        if(service.service_specific_attribute){
+          return service.service_specific_attribute.instance_id === instance.id;
+        }
+        return false;
+      }
+
+      var interfaceTree = [];
+      lodash.forEach(slices, (slice, i) => {
+        let current = {
+          name: slice.name,
+          slice: slice,
+          type: 'slice',
+          children: instances[i].map((instance) => {
+
+            return {
+              name: instance.humanReadableName,
+              children: [],
+              type: 'instance',
+              instance: instance,
+              active: isActive(service, instance)
+            };
+
+          })
+        };
+        interfaceTree.push(current);
+      });
+      return interfaceTree;
+    };
+
+    const getServiceInterfaces = (service) => {
+      var deferred = $q.defer();
+
+      var _slices;
+
+      Slice.query({service: service.id}).$promise
+      .then((slices) => {
+        _slices = slices;
+        const promisesArr = slices.reduce((promises, slice) => {
+          promises.push(Instances.query({slice: slice.id}).$promise);
+          return promises;
+        }, []);
+
+        // TODO add networks
+        // decide how, they should be manually drawn
+        // as they connect more instances without parent dependencies
+
+        return $q.all(promisesArr);
+      })
+      .then((instances) => {
+        deferred.resolve(buildServiceInterfacesTree(service, _slices, instances));
+      });
+
+      return deferred.promise;
+    };
+
+    // export APIs
+    return {
+      get: get,
+      buildLevel: buildLevel,
+      buildServiceTree: buildServiceTree,
+      findLevelRelation: findLevelRelation,
+      findLevelServices: findLevelServices,
+      depthOf: depthOf,
+      getServiceInterfaces: getServiceInterfaces,
+      buildServiceInterfacesTree: buildServiceInterfacesTree,
+      findSpecificInformation: findSpecificInformation
+    }
+  });
+
+}());
\ No newline at end of file
diff --git a/views/ngXosViews/serviceTopology/src/js/topologyCanvas.js b/views/ngXosViews/serviceTopology/src/js/topologyCanvas.js
new file mode 100644
index 0000000..8fce43d
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/src/js/topologyCanvas.js
@@ -0,0 +1,91 @@
+(function () {
+  'use strict';
+
+  angular.module('xos.serviceTopology')
+  .directive('serviceCanvas', function(){
+    return {
+      restrict: 'E',
+      scope: {},
+      bindToController: true,
+      controllerAs: 'vm',
+      templateUrl: 'templates/topology_canvas.tpl.html',
+      controller: function($element, $window, d3, serviceTopologyConfig, ServiceRelation, Slice, Instances, Subscribers, TreeLayout){
+
+        // NOTE $window is not the right reference, we should refer to container size
+
+        this.instances = [];
+        this.slices = [];
+
+        const width = $window.innerWidth - serviceTopologyConfig.widthMargin;
+        const height = $window.innerHeight - serviceTopologyConfig.heightMargin;
+
+        const treeLayout = d3.layout.tree()
+          .size([height, width]);
+
+        const svg = d3.select($element[0])
+          .append('svg')
+          .style('width', `${$window.innerWidth}px`)
+          .style('height', `${$window.innerHeight}px`)
+
+        const treeContainer = svg.append('g')
+          .attr('transform', 'translate(' + serviceTopologyConfig.widthMargin+ ',' + serviceTopologyConfig.heightMargin + ')');
+
+        //const resizeCanvas = () => {
+        //  var targetSize = svg.node().getBoundingClientRect();
+        //
+        //  d3.select(self.frameElement)
+        //    .attr('width', `${targetSize.width}px`)
+        //    .attr('height', `${targetSize.height}px`)
+        //};
+        //d3.select(window)
+        //  .on('load', () => {
+        //    resizeCanvas();
+        //  });
+        //d3.select(window)
+        //  .on('resize', () => {
+        //    resizeCanvas();
+        //    update(root);
+        //  });
+        var root;
+
+        const draw = (tree) => {
+          root = tree;
+          root.x0 = $window.innerHeight / 2;
+          root.y0 = 0;
+
+          TreeLayout.updateTree(treeContainer, treeLayout, root);
+        };
+
+        TreeLayout.drawLegend(svg);
+
+        var _this = this;
+
+        Subscribers.query().$promise
+        .then((subscribers) => {
+          this.subscribers = subscribers;
+          if(subscribers.length === 1){
+            this.selectedSubscriber = subscribers[0];
+            this.getServiceChain(this.selectedSubscriber);
+          }
+        });
+
+        this.getInstances = (slice) => {
+          Instances.query({slice: slice.id}).$promise
+          .then((instances) => {
+            this.selectedSlice = slice;
+            this.instances = instances;
+          })
+        };
+
+        // redraw when subrsbiber change
+        this.getServiceChain = (subscriber) => {
+          ServiceRelation.get(subscriber)
+            .then((tree) => {
+              draw(tree);
+            });
+        };
+      }
+    }
+  });
+
+}());
\ No newline at end of file
diff --git a/views/ngXosViews/serviceTopology/src/templates/topology_canvas.tpl.html b/views/ngXosViews/serviceTopology/src/templates/topology_canvas.tpl.html
new file mode 100644
index 0000000..aef5014
--- /dev/null
+++ b/views/ngXosViews/serviceTopology/src/templates/topology_canvas.tpl.html
@@ -0,0 +1,6 @@
+<div class="subscriber-select">
+    Select a subscriber:
+    <select class="form-control" ng-options="s as s.name for s in vm.subscribers" ng-model="vm.selectedSubscriber" ng-change="vm.getServiceChain(vm.selectedSubscriber)">
+        <option value="">Select a subscriber...</option>
+    </select>
+</div>
\ No newline at end of file
diff --git a/xos/configurations/frontend/service_chain.yaml b/xos/configurations/frontend/service_chain.yaml
new file mode 100644
index 0000000..557f98e
--- /dev/null
+++ b/xos/configurations/frontend/service_chain.yaml
@@ -0,0 +1,204 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Setup two subscriber with related service chain, use for development of serviceTopology view.
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+    # CORD Subscribers
+    Night's Watch:
+      type: tosca.nodes.CORDSubscriber
+      properties:
+        service_specific_id: 123
+        firewall_enable: false
+        cdn_enable: false
+        url_filter_enable: false
+        url_filter_level: R
+
+    # CORD Users for Night's Watch
+    Jhon Snow:
+      type: tosca.nodes.CORDUser
+      properties:
+        mac: 01:02:03:04:05:06
+        level: PG_13
+      requirements:
+        - household:
+            node: Night's Watch
+            relationship: tosca.relationships.SubscriberDevice
+
+    House Targaryen:
+      type: tosca.nodes.CORDSubscriber
+      properties:
+        service_specific_id: 321
+        firewall_enable: false
+        cdn_enable: false
+        url_filter_enable: false
+        url_filter_level: R
+
+    # CORD Users for House Targaryen
+    Daenerys:
+      type: tosca.nodes.CORDUser
+      properties:
+        mac: 06:05:04:03:02:01
+        level: PG_13
+      requirements:
+        - household:
+            node: House Targaryen
+            relationship: tosca.relationships.SubscriberDevice
+
+    # vOLT Tenants
+    Night's Watch vOLT:
+      type: tosca.nodes.VOLTTenant
+      properties:
+        service_specific_id: 123
+        s_tag: 123
+        c_tag: 456
+      requirements:
+        - provider_service:
+            node: service_volt
+            relationship: tosca.relationships.MemberOfService
+        - subscriber:
+            node: Night's Watch
+            relationship: tosca.relationships.BelongsToSubscriber
+
+    Targaryen vOLT:
+      type: tosca.nodes.VOLTTenant
+      properties:
+        service_specific_id: 321
+        s_tag: 321
+        c_tag: 654
+      requirements:
+        - provider_service:
+            node: service_volt
+            relationship: tosca.relationships.MemberOfService
+        - subscriber:
+            node: House Targaryen
+            relationship: tosca.relationships.BelongsToSubscriber
+
+    # CORD Services
+    service_volt:
+      type: tosca.nodes.Service
+      requirements:
+        - vcpe_tenant:
+            node: service_vcpe
+            relationship: tosca.relationships.TenantOfService
+        - lan_network:
+            node: lan_network
+            relationship: tosca.relationships.UsesNetwork
+        - wan_network:
+            node: wan_network
+            relationship: tosca.relationships.UsesNetwork
+      properties:
+        view_url: /admin/cord/voltservice/$id$/
+        kind: vOLT
+
+    service_vcpe:
+      type: tosca.nodes.VCPEService
+      requirements:
+        - vbng_tenant:
+            node: service_vbng
+            relationship: tosca.relationships.TenantOfService
+      properties:
+        view_url: /admin/cord/vcpeservice/$id$/
+        backend_network_label: hpc_client
+        public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
+        private_key_fn: /opt/xos/observers/vcpe/vcpe_private_key
+      artifacts:
+        pubkey: /root/.ssh/id_rsa.pub #is this right?
+
+    service_vbng:
+      type: tosca.nodes.VBNGService
+      properties:
+        view_url: /admin/cord/vbngservice/$id$/
+
+    # Networks required
+    lan_network:
+      type: tosca.nodes.network.Network
+      properties:
+        ip_version: 4
+      requirements:
+        - network_template:
+            node: Private
+            relationship: tosca.relationships.UsesNetworkTemplate
+        - owner:
+            node: mysite_vcpe
+            relationship: tosca.relationships.MemberOfSlice
+        - connection:
+            node: mysite_vcpe
+            relationship: tosca.relationships.ConnectsToSlice
+        - connection:
+            node: mysite_volt
+            relationship: tosca.relationships.ConnectsToSlice
+
+    wan_network:
+      type: tosca.nodes.network.Network
+      properties:
+        ip_version: 4
+      requirements:
+        - network_template:
+            node: Private
+            relationship: tosca.relationships.UsesNetworkTemplate
+        - owner:
+            node: mysite_vcpe
+            relationship: tosca.relationships.MemberOfSlice
+        - connection:
+            node: mysite_vcpe
+            relationship: tosca.relationships.ConnectsToSlice
+        - connection:
+            node: mysite_vbng
+            relationship: tosca.relationships.ConnectsToSlice
+
+    # Network templates
+    Private:
+      type: tosca.nodes.NetworkTemplate
+
+    # Sites
+    mysite:
+      type: tosca.nodes.Site
+
+    # Slices
+    mysite_vcpe:
+      description: vCPE Controller Slice
+      type: tosca.nodes.Slice
+      requirements:
+        - vcpe_service:
+            node: service_vcpe
+            relationship: tosca.relationships.MemberOfService
+        - site:
+            node: mysite
+            relationship: tosca.relationships.MemberOfSite
+        - vcpe_docker_image:
+            node: docker-vcpe
+            relationship: tosca.relationships.UsesImage
+      properties:
+          default_isolation: container
+
+    mysite_vbng:
+      description: slice running OVS controlled by vBNG
+      type: tosca.nodes.Slice
+      requirements:
+        - site:
+            node: mysite
+            relationship: tosca.relationships.MemberOfSite
+
+    mysite_volt:
+      description: OVS controlled by vOLT
+      type: tosca.nodes.Slice
+      requirements:
+        - site:
+            node: mysite
+            relationship: tosca.relationships.MemberOfSite
+
+    # docker image for vcpe containers
+    docker-vcpe:
+      # TODO: need to attach this to mydeployment
+      type: tosca.nodes.Image
+      properties:
+        kind: container
+        container_format: na
+        disk_format: na
+        path: andybavier/docker-vcpe
+        tag: develop
+