FM GUI as an NPM library for GUI 2

* added dynamic loading of external modules
* new commands on Alarm to allow create/updating/delete
* new fields in alarm gui

Change-Id: I9a7f4d665618a7949bb02039374974dabf6e5363
diff --git a/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmdetails/alarmdetails.component.css b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmdetails/alarmdetails.component.css
new file mode 100644
index 0000000..6bbd5bb
--- /dev/null
+++ b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmdetails/alarmdetails.component.css
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2018-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.
+ */
+
+/* css for alarm details table view */
+
+/* Panel Styling */
+#ov-alarm-table-item-details-panel.floatpanel {
+    z-index: 0;
+    font-size: 10pt;
+    top: 185px;
+}
+
+#ov-alarm-table-item-details-panel .container {
+    padding: 0 30px;
+}
+
+#ov-alarm-table-item-details-panel .close-btn {
+    position: absolute;
+    right:5px;
+    top: 5px;
+    cursor: pointer;
+}
+
+.light #ov-alarm-table-item-details-panel.floatpanel {
+    background-color: rgb(229, 234, 237);
+}
+.dark #ov-alarm-table-item-details-panel.floatpanel {
+    background-color: #3A4042;
+}
+
+#ov-alarm-table-item-details-panel h2 {
+    display: inline-block;
+    margin: 8px 0;
+    font-weight: bold;
+    font-size: 16pt;
+}
+
+#ov-alarm-table-item-details-panel h3 {
+    margin: 0;
+    font-size: large;
+}
+
+#ov-alarm-table-item-details-panel h4 {
+    margin: 0;
+}
+
+#ov-alarm-table-item-details-panel td {
+    padding: 5px;
+}
+#ov-alarm-table-item-details-panel td.label {
+    font-weight: bold;
+    text-align: right;
+    padding-right: 6px;
+}
diff --git a/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmdetails/alarmdetails.component.html b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmdetails/alarmdetails.component.html
new file mode 100644
index 0000000..72c1fb3
--- /dev/null
+++ b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmdetails/alarmdetails.component.html
@@ -0,0 +1,82 @@
+<!--
+~ Copyright 2018-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.
+-->
+
+<div id="ov-alarm-table-item-details-panel" class="floatpanel" [@alarmDetailsState]="id!=='' && !closed">
+  <div class="container">
+    <div class="top">
+      <div class="close-btn">
+        <onos-icon class="close-btn" classes="active-close" iconId="close" iconSize="20" (click)="close()"></onos-icon>
+      </div>
+      <h2 class="editable clickable">{{detailsData.id}}</h2>
+      <div class="top-content">
+        <div class="top-tables">
+          <div class="left">
+            <table>
+              <tbody>
+              <tr>
+                <td class="label" width="110">Description:</td>
+                <td class="value" width="80">{{detailsData.alarmDesc}}</td>
+              </tr>
+              <tr>
+                <td class="label" width="110">Device ID :</td>
+                <td class="value" width="80">{{detailsData.alarmDeviceId}}</td>
+              </tr>
+              <tr>
+                <td class="label" width="110">Alarm source :</td>
+                <td class="value" width="80">{{detailsData.alarmSource}}</td>
+              </tr>
+              <tr>
+                <td class="label" width="110">Time raised :</td>
+                <td class="value" width="80">{{detailsData.alarmTimeRaised}}</td>
+              </tr>
+              <tr>
+                <td class="label" width="110">Time updated :</td>
+                <td class="value" width="80">{{detailsData.alarmTimeUpdated}}</td>
+              </tr>
+              <tr>
+                <td class="label" width="110">Cleared :</td>
+                <td class="value" width="80">{{detailsData.alarmCleared}}</td>
+              </tr>
+              <tr>
+                <td class="label" width="110">Time cleared :</td>
+                <td class="value" width="80">{{detailsData.alarmTimeCleared}}</td>
+              </tr>
+              <tr>
+                <td class="label" width="110">Severity :</td>
+                <td class="value" width="80">{{detailsData.alarmSeverity}}</td>
+              </tr>
+              <hr>
+              <tr>
+                <td class="label" width="110">Service affecting :</td>
+                <td class="value" width="80">{{detailsData.alarmServiceAffecting}}</td>
+              </tr>
+              <tr>
+                <td class="label" width="110">Acknowledged :</td>
+                <td class="value" width="80">{{detailsData.alarmAcknowledged}}</td>
+              </tr>
+              <tr>
+                <td class="label" width="110">Assigned User :</td>
+                <td class="value" width="80">{{detailsData.alarmAssignedUser}}</td>
+              </tr>
+              </tbody>
+            </table>
+          </div>
+        </div>
+      </div>
+      <hr>
+    </div>
+  </div>
+</div>
diff --git a/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmdetails/alarmdetails.component.spec.ts b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmdetails/alarmdetails.component.spec.ts
new file mode 100644
index 0000000..7b7d61e
--- /dev/null
+++ b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmdetails/alarmdetails.component.spec.ts
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2018-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 { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { AlarmDetailsComponent } from './alarmdetails.component';
+import { ActivatedRoute, Params } from '@angular/router';
+import { of } from 'rxjs/index';
+import {
+    FnService,
+    IconService,
+    LogService,
+    WebSocketService,
+    IconComponent
+} from 'gui2-fw-lib';
+
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { DebugElement } from '@angular/core';
+import { By } from '@angular/platform-browser';
+import { } from 'jasmine';
+
+class MockActivatedRoute extends ActivatedRoute {
+    constructor(params: Params) {
+        super();
+        this.queryParams = of(params);
+    }
+}
+
+class MockIconService {
+    classes = 'active-close';
+    loadIconDef() { }
+}
+
+class MockWebSocketService {
+    createWebSocket() { }
+    isConnected() { return false; }
+    unbindHandlers() { }
+    bindHandlers() { }
+}
+
+describe('AlarmDetailsComponent', () => {
+    let fs: FnService;
+    let ar: MockActivatedRoute;
+    let windowMock: Window;
+    let logServiceSpy: jasmine.SpyObj<LogService>;
+    let component: AlarmDetailsComponent;
+    let fixture: ComponentFixture<AlarmDetailsComponent>;
+
+    beforeEach(async(() => {
+        const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
+        ar = new MockActivatedRoute({ 'debug': 'panel' });
+        windowMock = <any>{
+            location: <any>{
+                hostname: 'foo',
+                host: 'foo',
+                port: '80',
+                protocol: 'http',
+                search: { debug: 'true' },
+                href: 'ws://foo:123/onos/ui/websock/path',
+                absUrl: 'ws://foo:123/onos/ui/websock/path'
+            }
+        };
+        fs = new FnService(ar, logSpy, windowMock);
+
+        TestBed.configureTestingModule({
+            imports: [BrowserAnimationsModule],
+            declarations: [ AlarmDetailsComponent, IconComponent ],
+            providers: [
+                { provide: FnService, useValue: fs },
+                { provide: IconService, useClass: MockIconService },
+                { provide: LogService, useValue: logSpy },
+                { provide: WebSocketService, useClass: MockWebSocketService },
+                { provide: 'Window', useValue: windowMock },
+            ]
+        })
+        .compileComponents();
+        logServiceSpy = TestBed.get(LogService);
+    }));
+
+    beforeEach(() => {
+        fixture = TestBed.createComponent(AlarmDetailsComponent);
+        component = fixture.componentInstance;
+        fixture.detectChanges();
+    });
+
+    it('should create', () => {
+        expect(component).toBeTruthy();
+    });
+});
diff --git a/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmdetails/alarmdetails.component.ts b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmdetails/alarmdetails.component.ts
new file mode 100644
index 0000000..0767cd9
--- /dev/null
+++ b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmdetails/alarmdetails.component.ts
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2018-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 { Component, Input, OnInit, OnDestroy, OnChanges } from '@angular/core';
+import { trigger, state, style, animate, transition } from '@angular/animations';
+import {
+    FnService,
+    IconService,
+    LoadingService,
+    LogService,
+    DetailsPanelBaseImpl,
+    WebSocketService,
+} from 'gui2-fw-lib';
+
+/**
+ * ONOS GUI -- Alarm Details Component extends TableBaseImpl
+ * The details view when an alarm row is clicked from the Alarm view
+ *
+ * This is expected to be passed an 'id' and it makes a call
+ * to the WebSocket with an alarmDetailsRequest, and gets back an
+ * alarmDetailsResponse.
+ *
+ * The animated fly-in is controlled by the animation below
+ * The alarmDetailsState is attached to alarm-details-panel
+ * and is false (flies out) when id='' and true (flies in) when
+ * id has a value
+ */
+@Component({
+    selector: 'onos-alarmdetails',
+    templateUrl: './alarmdetails.component.html',
+    styleUrls: ['./alarmdetails.component.css',
+          '../../../fw/widget/panel.css', '../../../fw/widget/panel-theme.css'
+    ],
+    animations: [
+        trigger('alarmDetailsState', [
+            state('true', style({
+                transform: 'translateX(-100%)',
+                opacity: '100'
+            })),
+            state('false', style({
+                transform: 'translateX(0%)',
+                opacity: '0'
+            })),
+            transition('0 => 1', animate('100ms ease-in')),
+            transition('1 => 0', animate('100ms ease-out'))
+        ])
+    ]
+})
+export class AlarmDetailsComponent extends DetailsPanelBaseImpl implements OnInit, OnDestroy, OnChanges {
+    @Input() id: string;
+
+    constructor(
+        protected fs: FnService,
+        protected ls: LoadingService,
+        protected log: LogService,
+        protected is: IconService,
+        protected wss: WebSocketService
+    ) {
+        super(fs, ls, log, wss, 'alarmTable');
+    }
+
+    ngOnInit() {
+        this.init();
+        this.log.debug('Alarm Table Details Component initialized:', this.id);
+    }
+
+    /**
+     * Stop listening to alarmTableDetailsResponse on WebSocket
+     */
+    ngOnDestroy() {
+        this.destroy();
+        this.log.debug('Alarm Table Details Component destroyed');
+    }
+
+    /**
+     * Details Panel Data Request on row selection changes
+     * Should be called whenever id changes
+     * If id is empty, no request is made
+     */
+    ngOnChanges() {
+        if (this.id === '') {
+            return '';
+        } else {
+            const query = {
+                'id': this.id
+            };
+            this.requestDetailsPanelData(query);
+        }
+    }
+}
diff --git a/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmtable/alarmtable.component.css b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmtable/alarmtable.component.css
new file mode 100644
index 0000000..c7af5aa
--- /dev/null
+++ b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmtable/alarmtable.component.css
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2018-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.
+ */
+
+/* css for alarm table view */
+
+#ov-alarm-table h2 {
+    display: inline-block;
+}
diff --git a/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmtable/alarmtable.component.html b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmtable/alarmtable.component.html
new file mode 100644
index 0000000..534819e
--- /dev/null
+++ b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmtable/alarmtable.component.html
@@ -0,0 +1,87 @@
+<!--
+~ Copyright 2018-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.
+-->
+<div id="ov-alarm-table">
+  <div class="tabular-header">
+    <h2>Alarms  for {{ "all devices."}} ({{ tableData.length }} total)</h2>
+    <div class="ctrl-btns">
+      <div class="refresh" (click)="toggleRefresh()">
+        <!-- See icon.theme.css for the defintions of the classes active and refresh-->
+        <onos-icon classes="{{ autoRefresh?'active refresh':'refresh' }}" iconId="refresh" iconSize="36" toolTip="{{ autoRefreshTip }}"></onos-icon>
+      </div>
+      <!--div class="separator"></div>
+      <div (click)="(!!selId) ? confirmAction(AlarmActionEnum.ACKNOWLEDGE) : ''">
+        <onos-icon classes="{{ ctrlBtnState.acknowledged?'active-rect play':'play' }}"
+                   iconId="play" iconSize="42" toolTip="{{ acknowledgeTip }}"></onos-icon>
+      </div>
+      <div (click)="(!!selId) ? confirmAction(AlarmActionEnum.CLEAR) : ''">
+        <onos-icon classes="{{ ctrlBtnState.cleared?'active-rect stop':'stop' }}"
+                   iconId="stop" iconSize="42" toolTip="{{ clearTip }}"></onos-icon>
+      </div-->
+    </div>
+  </div>
+
+  <div class="summary-list" class="summary-list" onosTableResize>
+
+    <div class="table-header">
+      <table>
+        <tr>
+          <td colId="alarmId" (click)="onSort('id')">Id
+              <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('id')"></onos-icon>
+          </td>
+          <td colId="alarmDeviceId" (click)="onSort('alarmDeviceId')">Device
+              <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('alarmDeviceId')"></onos-icon>
+          </td>
+          <td colId="alarmDesc" (click)="onSort('alarmDesc')">Description
+              <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('alarmDesc')"></onos-icon>
+          </td>
+          <td colId="alarmSource" (click)="onSort('alarmSource')">Source
+              <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('alarmSource')"></onos-icon>
+          </td>
+          <td colId="alarmTimeRaised" (click)="onSort('alarmTimeRaised')">Time Raised
+              <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('alarmTimeRaised')"></onos-icon>
+          </td>
+          <td colId="alarmSeverity" (click)="onSort('alarmSeverity')">Severity
+              <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('alarmSeverity')"></onos-icon>
+          </td>
+          <td colId="alarmAcknowledged" (click)="onSort('alarmAcknowledged')">Acknowledged
+              <onos-icon classes="active-sort" [iconSize]="10" [iconId]="sortIcon('alarmAcknowledged')"></onos-icon>
+          </td>
+        </tr>
+      </table>
+    </div>
+
+    <div class="table-body">
+      <table>
+        <tr class="table-body" *ngIf="tableData.length === 0" class="no-data">
+          <td colspan="9">{{ annots.noRowsMsg }}</td>
+        </tr>
+        <tr *ngFor="let item of tableData | filter : tableDataFilter" (click)="selectCallback($event, item)" [ngClass]="{selected: item.id === selId, 'data-change': isChanged(item.id)}">
+          <td>{{ item.id }}</td>
+          <td>{{ item.alarmDeviceId }}</td>
+          <td>{{ item.alarmDesc }}</td>
+          <td>{{ item.alarmSource }}</td>
+          <td>{{ item.alarmTimeRaised }}</td>
+          <td>{{ item.alarmSeverity }}</td>
+          <td class="table-icon">
+            <onos-icon [iconId]="ackIcon(item.alarmAcknowledged)"></onos-icon>
+          </td>
+        </tr>
+      </table>
+    </div>
+  </div>
+
+  <onos-alarmdetails class="floatpanels" id="{{ selId }}" (closeEvent)="deselectRow($event)"></onos-alarmdetails>
+</div>
diff --git a/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmtable/alarmtable.component.spec.ts b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmtable/alarmtable.component.spec.ts
new file mode 100644
index 0000000..ccad204
--- /dev/null
+++ b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmtable/alarmtable.component.spec.ts
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2018-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 { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { ActivatedRoute, Params } from '@angular/router';
+import { DebugElement } from '@angular/core';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { FormsModule } from '@angular/forms';
+import { By } from '@angular/platform-browser';
+import { AlarmTableComponent } from './alarmtable.component';
+import { AlarmDetailsComponent } from '../alarmdetails/alarmdetails.component';
+import {
+    FnService,
+    IconService,
+    GlyphService,
+    IconComponent,
+    LoadingService,
+    LogService,
+    NavService,
+    MastService,
+    TableFilterPipe,
+    ThemeService,
+    WebSocketService
+} from 'gui2-fw-lib';
+
+import { of } from 'rxjs';
+import { } from 'jasmine';
+import { RouterTestingModule } from '@angular/router/testing';
+
+class MockActivatedRoute extends ActivatedRoute {
+    constructor(params: Params) {
+        super();
+        this.queryParams = of(params);
+    }
+}
+
+class MockIconService {
+    loadIconDef() { }
+}
+
+class MockLoadingService {
+    startAnim() { }
+    stop() { }
+    waiting() { }
+}
+
+describe('AlarmTableComponent', () => {
+    let fs: FnService;
+    let ar: MockActivatedRoute;
+    let windowMock: Window;
+    let logServiceSpy: jasmine.SpyObj<LogService>;
+    let component: AlarmTableComponent;
+    let fixture: ComponentFixture<AlarmTableComponent>;
+
+    beforeEach(async(() => {
+        const logSpy = jasmine.createSpyObj('LogService', ['info', 'debug', 'warn', 'error']);
+        ar = new MockActivatedRoute({ 'debug': 'txrx' });
+
+        windowMock = <any>{
+            location: <any>{
+                hostname: 'foo',
+                host: 'foo',
+                port: '80',
+                protocol: 'http',
+                search: { debug: 'true' },
+                href: 'ws://foo:123/onos/ui/websock/path',
+                absUrl: 'ws://foo:123/onos/ui/websock/path'
+            }
+        };
+        fs = new FnService(ar, logSpy, windowMock);
+
+        TestBed.configureTestingModule({
+            imports: [BrowserAnimationsModule, FormsModule, RouterTestingModule],
+            declarations: [
+                AlarmTableComponent, AlarmDetailsComponent,
+                IconComponent, TableFilterPipe
+             ],
+            providers: [
+                { provide: FnService, useValue: fs },
+                { provide: LogService, useValue: logSpy },
+                { provide: LoadingService, useClass: MockLoadingService },
+                { provide: IconService, useClass: MockIconService },
+                { provide: 'Window', useValue: windowMock },
+            ]
+        })
+        .compileComponents();
+        logServiceSpy = TestBed.get(LogService);
+    }));
+
+    beforeEach(() => {
+        fixture = TestBed.createComponent(AlarmTableComponent);
+        component = fixture.componentInstance;
+        fixture.detectChanges();
+    });
+
+    it('should create', () => {
+        expect(component).toBeTruthy();
+    });
+});
diff --git a/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmtable/alarmtable.component.ts b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmtable/alarmtable.component.ts
new file mode 100644
index 0000000..d2e46b2
--- /dev/null
+++ b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/alarmtable/alarmtable.component.ts
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2018-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 { Component, Input, Inject, OnInit, OnDestroy } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+import {
+    FnService,
+    LoadingService,
+    LogService,
+    WebSocketService,
+    SortDir, TableBaseImpl, TableResponse
+} from 'gui2-fw-lib';
+
+/**
+ * Model of the response from the WebSocket
+ */
+export interface AlarmTableResponse extends TableResponse {
+    alarmTables: Alarm[];
+}
+
+/**
+ * Model of the alarms returned from the WebSocket
+ */
+export interface Alarm {
+    id: string;
+    alarmDesc: string;
+    alarmDeviceId: string;
+    alarmSource: string;
+    alarmTimeRaised: string;
+    alarmTimeUpdated: string;
+    alarmTimeCleared: string;
+    alarmSeverity: string;
+}
+
+export enum AlarmAction {
+    NONE = 0,
+    ACKNOWLEDGE = 1,
+    CLEAR = 2,
+}
+
+/**
+ * Model of the Control Button
+ */
+export interface CtrlBtnState {
+    acknowledged: boolean;
+    cleared: boolean;
+    selection: string;
+}
+
+const ACKNOWLEDGED = 'ACKNOWLEDGED';
+const CLEARED = 'CLEARED';
+
+/**
+* ONOS GUI -- Alarm Table Component extends TableBaseImpl
+*/
+@Component({
+    selector: 'onos-alarmtable',
+    templateUrl: './alarmtable.component.html',
+    styleUrls: ['./alarmtable.component.css', '../../../fw/widget/table.css', '../../../fw/widget/table.theme.css']
+})
+export class AlarmTableComponent extends TableBaseImpl implements OnInit, OnDestroy {
+    devId: string;
+    selRowAlarmId: string;
+    // TODO Add in LION translations
+    acknowledgeTip: string = 'Acknowledge';
+    clearTip: string = 'Clear';
+    AlarmActionEnum: any = AlarmAction;
+    alarmAction: AlarmAction = AlarmAction.NONE;
+    confirmMsg: string = '';
+    ctrlBtnState: CtrlBtnState;
+
+    constructor(
+        private route: ActivatedRoute,
+        @Inject('Window') private w: any,
+        protected log: LogService,
+        protected ls: LoadingService,
+        protected fs: FnService,
+        protected wss: WebSocketService,
+    ) {
+        super(fs, ls, log, wss, 'alarmTable');
+
+        this.route.queryParams.subscribe(params => {
+            this.devId = params['devId'];
+
+        });
+
+        this.payloadParams = {
+            devId: this.devId
+        };
+
+        this.responseCallback = this.alarmResponseCb;
+
+        this.sortParams = {
+            firstCol: 'alarmTimeRaised',
+            firstDir: SortDir.desc,
+            secondCol: 'alarmDeviceId',
+            secondDir: SortDir.asc,
+        };
+
+        this.ctrlBtnState = <CtrlBtnState>{
+            acknowledged: false,
+            cleared: false
+        };
+        this.log.debug('AlarmTableComponent constructed');
+    }
+
+    ngOnInit() {
+        this.init();
+        this.log.debug('AlarmTableComponent initialized');
+    }
+
+    ngOnDestroy() {
+        this.destroy();
+        this.log.debug('AlarmTableComponent destroyed');
+    }
+
+    alarmResponseCb(data: AlarmTableResponse) {
+        this.log.debug('Alarm response received for ', data.alarmTables.length, 'alarm');
+    }
+
+    rowSelection(event: any, selRow: any) {
+        this.ctrlBtnState.acknowledged = this.selId && selRow && selRow.state === ACKNOWLEDGED;
+        this.ctrlBtnState.cleared = this.selId && selRow && selRow.cleared === CLEARED;
+        this.ctrlBtnState.selection = this.selId;
+        this.selRowAlarmId = selRow.appId;
+        this.log.debug('Row ', this.selId, 'selected', this.ctrlBtnState);
+    }
+
+    /**
+     * Perform one of the alarm actions - acknowledge or clear
+     * Raises a dialog which calls back the dOk() below
+     */
+    confirmAction(action: AlarmAction): void {
+        this.alarmAction = action;
+        const alarmActionLc = (<string>AlarmAction[this.alarmAction]).toLowerCase();
+
+        this.confirmMsg = alarmActionLc + ' ' + this.selId + '?';
+
+        this.log.debug('Initiating', this.alarmAction, 'of', this.selId);
+    }
+
+    /**
+     * Callback when the Confirm dialog is shown and a choice is made
+     */
+    dOk(choice: boolean) {
+        const alarmActionLc = (<string>AlarmAction[this.alarmAction]).toLowerCase();
+        if (choice) {
+            this.log.debug('Confirmed', alarmActionLc, 'on', this.selId);
+
+            /** commented out until backend is implemented
+            this.wss.sendEvent(APPMGMTREQ, {
+                action: alarmActionLc,
+                name: this.selId,
+                sortCol: this.sortParams.firstCol,
+                sortDir: SortDir[this.sortParams.firstDir],
+            });
+
+            this.wss.sendEvent(DETAILSREQ, { id: this.selId });
+            */
+        } else {
+            this.log.debug('Cancelled', alarmActionLc, 'on', this.selId);
+        }
+        this.confirmMsg = '';
+    }
+
+    ackIcon(acknowledged: string): string {
+        if (acknowledged === 'true') {
+            return 'active';
+        } else {
+            return 'appInactive';
+        }
+    }
+}
diff --git a/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/fm-gui2-lib-routing.module.ts b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/fm-gui2-lib-routing.module.ts
new file mode 100644
index 0000000..8aff3d4
--- /dev/null
+++ b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/fm-gui2-lib-routing.module.ts
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2018-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 { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+import { AlarmTableComponent } from './alarmtable/alarmtable.component';
+
+const fmRoutes: Routes = [
+    {
+        path: '',
+        component: AlarmTableComponent
+    }
+];
+
+/**
+ * ONOS GUI -- FM GUI Routing Module - allows it to be lazy loaded
+ *
+ * See https://angular.io/guide/lazy-loading-ngmodules
+ */
+@NgModule({
+    imports: [RouterModule.forChild(fmRoutes)],
+    exports: [RouterModule]
+})
+export class FmGui2LibRoutingModule { }
diff --git a/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/fm-gui2-lib.module.ts b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/fm-gui2-lib.module.ts
new file mode 100644
index 0000000..a759624
--- /dev/null
+++ b/apps/faultmanagement/fm-gui2-lib/projects/fm-gui2-lib/src/lib/fm-gui2-lib.module.ts
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2018-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 { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+import { FmGui2LibRoutingModule } from './fm-gui2-lib-routing.module';
+import { Gui2FwLibModule, ConsoleLoggerService, LogService } from 'gui2-fw-lib';
+import { AlarmTableComponent } from './alarmtable/alarmtable.component';
+import { AlarmDetailsComponent } from './alarmdetails/alarmdetails.component';
+
+@NgModule({
+    imports: [
+        CommonModule,
+        FormsModule,
+        FmGui2LibRoutingModule,
+        Gui2FwLibModule
+    ],
+    declarations: [ AlarmTableComponent, AlarmDetailsComponent ],
+    exports: [ AlarmTableComponent, AlarmDetailsComponent ],
+})
+export class FmGui2LibModule { }