GUI2 Extract Topology view in to its own library

Change-Id: I45597d0902c99b5b3d606966866cc518011c54a0
diff --git a/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.component.css b/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.component.css
new file mode 100644
index 0000000..e6f8352
--- /dev/null
+++ b/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.component.css
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2019-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#view h2 {
+    color: #3c3a3a;
+    /*margin: 32px 0 4px 16px;*/
+    padding: 0;
+    font-size: 18pt;
+    font-weight: lighter;
+}
+
+a {
+    color: #009fdb;
+    text-decoration: none;
+}
+a:hover {
+    text-decoration: underline;
+}
+a:visited {
+    color: #7fabdb;
+    text-decoration: none;
+}
diff --git a/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.component.html b/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.component.html
new file mode 100644
index 0000000..9293382
--- /dev/null
+++ b/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.component.html
@@ -0,0 +1,7 @@
+<!--The content below is only a placeholder and can be replaced.-->
+<div style="text-align:center">
+  <p>ONOS Topology view test application</p>
+</div>
+<onos-topology [bannerHeight]="50"></onos-topology>
+
+
diff --git a/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.component.spec.ts b/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.component.spec.ts
new file mode 100644
index 0000000..964800f
--- /dev/null
+++ b/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.component.spec.ts
@@ -0,0 +1,31 @@
+import { TestBed, async } from '@angular/core/testing';
+import { AppComponent } from './app.component';
+
+describe('AppComponent', () => {
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [
+        AppComponent
+      ],
+    }).compileComponents();
+  }));
+
+  it('should create the app', () => {
+    const fixture = TestBed.createComponent(AppComponent);
+    const app = fixture.debugElement.componentInstance;
+    expect(app).toBeTruthy();
+  });
+
+  it(`should have as title 'gui2-topo-tester'`, () => {
+    const fixture = TestBed.createComponent(AppComponent);
+    const app = fixture.debugElement.componentInstance;
+    expect(app.title).toEqual('gui2-topo-tester');
+  });
+
+  it('should render title in a h1 tag', () => {
+    const fixture = TestBed.createComponent(AppComponent);
+    fixture.detectChanges();
+    const compiled = fixture.debugElement.nativeElement;
+    expect(compiled.querySelector('h1').textContent).toContain('Welcome to gui2-topo-tester!');
+  });
+});
diff --git a/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.component.ts b/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.component.ts
new file mode 100644
index 0000000..4261f48
--- /dev/null
+++ b/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.component.ts
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2019-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import {AfterViewInit, Component, OnDestroy} from '@angular/core';
+import {
+    GlyphService,
+    KeysService,
+    LionService,
+    LogService,
+    ThemeService,
+    WebSocketService,
+    WsOptions
+} from 'gui2-fw-lib';
+import * as d3 from 'd3';
+
+@Component({
+  selector: 'app-root',
+  templateUrl: './app.component.html',
+  styleUrls: ['./app.component.css']
+})
+export class AppComponent implements AfterViewInit, OnDestroy {
+    title = 'gui2-topo-tester';
+
+    constructor (
+        private lion: LionService,
+        private ts: ThemeService,
+        private gs: GlyphService,
+        private ks: KeysService,
+        public wss: WebSocketService,
+        private log: LogService,
+    ) {
+        // Testing of debugging
+        log.debug('OnosComponent: testing logger.debug()');
+        log.info('OnosComponent: testing logger.info()');
+        log.warn('OnosComponent: testing logger.warn()');
+        log.error('OnosComponent: testing logger.error()');
+
+        this.wss.createWebSocket(<WsOptions>{ wsport: 8181});
+
+        log.debug('OnosComponent constructed');
+    }
+
+    ngAfterViewInit(): void {
+        this.ks.installOn(d3.select('body'));
+        this.log.debug('AppComponent after view initialized');
+    }
+
+
+    ngOnDestroy() {
+        if (this.wss.isConnected()) {
+            this.log.debug('Stopping Web Socket connection');
+            this.wss.closeWebSocket();
+        }
+
+        this.log.debug('AppComponent destroyed');
+    }
+}
diff --git a/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.module.ts b/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.module.ts
new file mode 100644
index 0000000..2fbba74
--- /dev/null
+++ b/web/gui2-topo-lib/projects/gui2-topo-tester/src/app/app.module.ts
@@ -0,0 +1,33 @@
+import { BrowserModule } from '@angular/platform-browser';
+import { NgModule } from '@angular/core';
+
+import { AppComponent } from './app.component';
+import {ConsoleLoggerService, Gui2FwLibModule, LogService} from 'gui2-fw-lib';
+import {Gui2TopoLibModule} from 'gui2-topo-lib';
+import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
+import {RouterModule, Routes} from '@angular/router';
+import {HttpClientModule} from '@angular/common/http';
+
+const appRoutes: Routes = [
+    { path: '**', component: AppComponent }
+]
+
+@NgModule({
+    declarations: [
+        AppComponent
+    ],
+    imports: [
+        RouterModule.forRoot(appRoutes),
+        BrowserModule,
+        BrowserAnimationsModule,
+        Gui2FwLibModule,
+        Gui2TopoLibModule,
+        HttpClientModule
+    ],
+    providers: [
+        { provide: LogService, useClass: ConsoleLoggerService },
+        { provide: 'Window', useValue: window }
+    ],
+    bootstrap: [AppComponent]
+})
+export class AppModule { }