OSAM infra seed code - merge with osam-core side-by-side - fixed warnings in onap-enabler POMs

Change-Id: I0cd9ea39d4b7c1dc088ab0ecd6fb787c7f490e5e
Signed-off-by: Aharoni, Pavel (pa0916) <pavel.aharoni@intl.att.com>
diff --git a/osam-core/.mvn/wrapper/maven-wrapper.jar b/osam-core/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 0000000..9cc84ea
--- /dev/null
+++ b/osam-core/.mvn/wrapper/maven-wrapper.jar
Binary files differ
diff --git a/osam-core/.mvn/wrapper/maven-wrapper.properties b/osam-core/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 0000000..488eeee
--- /dev/null
+++ b/osam-core/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1 @@
+distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip

diff --git a/osam-core/README.md b/osam-core/README.md
new file mode 100644
index 0000000..f354b71
--- /dev/null
+++ b/osam-core/README.md
@@ -0,0 +1,9 @@
+# OSAM

+```

+docker pull mariadb

+

+docker run --name springbootdb -e MYSQL_DATABASE=osam -e MYSQL_USER=root -e MYSQL_ROOT_PASSWORD=root  -d -p 3306:3306  mariadb

+```

+Restructure:`mvn clean package spring-boot:repackage`

+

+Run:`mvn spring-boot:run -X`

diff --git a/osam-core/api/pom.xml b/osam-core/api/pom.xml
new file mode 100644
index 0000000..e8cee60
--- /dev/null
+++ b/osam-core/api/pom.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!--/*-

+        * ============LICENSE_START=======================================================

+        * OSAM Core

+        * ================================================================================

+        * Copyright (C) 2018 Netsia

+        * ================================================================================

+        * 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.

+        * ============LICENSE_END=========================================================

+        */-->

+<project xmlns="http://maven.apache.org/POM/4.0.0"

+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

+    <parent>

+        <artifactId>osam-core</artifactId>

+        <groupId>org.onap.osam</groupId>

+        <version>0.0.1-SNAPSHOT</version>

+    </parent>

+    <modelVersion>4.0.0</modelVersion>

+    <artifactId>api</artifactId>

+

+    <dependencies>

+        <dependency>

+            <groupId>org.onap.osam</groupId>

+            <artifactId>model</artifactId>

+            <version>${project.version}</version>

+        </dependency>

+        <dependency>

+            <groupId>org.onap.osam</groupId>

+            <artifactId>common</artifactId>

+            <version>${project.version}</version>

+        </dependency>

+    </dependencies>

+

+</project>
\ No newline at end of file
diff --git a/osam-core/api/src/main/java/org/onap/osam/api/service/AbstractStorageService.java b/osam-core/api/src/main/java/org/onap/osam/api/service/AbstractStorageService.java
new file mode 100644
index 0000000..c7c7375
--- /dev/null
+++ b/osam-core/api/src/main/java/org/onap/osam/api/service/AbstractStorageService.java
@@ -0,0 +1,36 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.api.service;

+

+import java.util.List;

+

+public interface AbstractStorageService <K,V>{

+

+    V addOrUpdate(V value);

+

+    void removeById(K key);

+

+    V getById(K key);

+

+    List<V> getAll();

+}

diff --git a/osam-core/api/src/main/java/org/onap/osam/api/service/AccessPodService.java b/osam-core/api/src/main/java/org/onap/osam/api/service/AccessPodService.java
new file mode 100644
index 0000000..da0a9b9
--- /dev/null
+++ b/osam-core/api/src/main/java/org/onap/osam/api/service/AccessPodService.java
@@ -0,0 +1,33 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.api.service;

+

+import org.onap.osam.model.dao.AccessPod;

+

+/**

+ * Created by cemturker on 26.09.2018.

+ */

+public interface AccessPodService extends AbstractStorageService<Long, AccessPod>{

+    AccessPod findByPnfId(String pnfId);

+    void removeByPnfId(String pnfId);

+}

diff --git a/osam-core/api/src/main/java/org/onap/osam/api/service/AlarmService.java b/osam-core/api/src/main/java/org/onap/osam/api/service/AlarmService.java
new file mode 100644
index 0000000..5fd8468
--- /dev/null
+++ b/osam-core/api/src/main/java/org/onap/osam/api/service/AlarmService.java
@@ -0,0 +1,43 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.api.service;

+

+import org.onap.osam.model.dao.AlarmsAndEvents;

+import org.onap.osam.model.dao.ActiveAlarmsAndEvents;

+import org.onap.osam.model.dao.HistoricalAlarmsAndEvents;

+

+import java.util.Date;

+import java.util.List;

+

+/**

+ *  basic methods belongs to Active Alarms

+ */

+public interface AlarmService{

+

+    List<ActiveAlarmsAndEvents> getActiveAlarmsAndEventsByDate(Date startDate, Date endDate);

+

+    List<HistoricalAlarmsAndEvents> getHistoricalAlarmsAndEventsByDate(Date startDate, Date endDate);

+

+    void addOrUpdate(AlarmsAndEvents alarmsAndEvents);

+

+}

diff --git a/osam-core/api/src/main/java/org/onap/osam/api/service/BroadBandService.java b/osam-core/api/src/main/java/org/onap/osam/api/service/BroadBandService.java
new file mode 100644
index 0000000..7ccaea8
--- /dev/null
+++ b/osam-core/api/src/main/java/org/onap/osam/api/service/BroadBandService.java
@@ -0,0 +1,111 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.api.service;

+

+import org.onap.osam.model.dao.Service;

+import org.onap.osam.model.dao.SpeedProfile;

+import org.onap.osam.model.dao.TechnologyProfile;

+

+import java.util.List;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+public interface BroadBandService {

+    /**

+     *

+     * @param speedProfile

+     */

+    SpeedProfile addSpeedProfile(SpeedProfile speedProfile);

+

+    /**

+     *

+     * @param technologyProfile

+     */

+    TechnologyProfile addTechnologyProfile(TechnologyProfile technologyProfile);

+

+    /**

+     *

+     * @param service

+     */

+    Service addService(Service service);

+

+    /**

+     *

+     * @param id

+     */

+    void removeSpeedProfile(Long id);

+

+    /**

+     *

+     * @param id

+     */

+    void removeTechnologyProfile(Long id);

+

+    /**

+     *

+     * @param id

+     */

+    void removeService(Long id);

+

+    /**

+     *

+     * @param id

+     * @return

+     */

+    SpeedProfile getSpeedProfile(Long id);

+

+    /**

+     *

+     * @param id

+     * @return

+     */

+    TechnologyProfile getTechnologyProfile(Long id);

+

+    /**

+     *

+     * @param id

+     * @return

+     */

+    Service getService(Long id);

+

+    /**

+     *

+     * @return

+     */

+    List<SpeedProfile> getSpeedProfiles();

+

+    /**

+     *

+     * @return

+     */

+    List<TechnologyProfile> getTechnologyProfiles();

+

+    /**

+     *

+     * @return

+     */

+    List<Service> getServices();

+

+}

+

diff --git a/osam-core/api/src/main/java/org/onap/osam/api/service/DeviceService.java b/osam-core/api/src/main/java/org/onap/osam/api/service/DeviceService.java
new file mode 100644
index 0000000..dd49993
--- /dev/null
+++ b/osam-core/api/src/main/java/org/onap/osam/api/service/DeviceService.java
@@ -0,0 +1,183 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.api.service;

+

+import org.onap.osam.model.dao.Chassis;

+import org.onap.osam.model.dao.OLTPort;

+import org.onap.osam.model.dao.OLTSlot;

+import org.onap.osam.model.dao.ONTDevice;

+

+import java.util.List;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+public interface DeviceService {

+

+

+/*

+Chassis Related Functionality

+---------------------------------------------------------------------------------------

+*/

+

+    /**

+     *

+     * @param chassis

+     */

+    Chassis addChassis(Chassis chassis);

+

+    /**

+     *

+     * @param id

+     */

+    void deleteChassis(Long id);

+

+    /**

+     *

+     * @param clli

+     */

+    public void deleteChassisByClli(String clli);

+

+    /**

+     *

+     * @param id

+     * @return Chassis

+     */

+    Chassis getChassisById(Long id);

+

+    /**

+     *

+     * @param clli

+     * @return Chassis

+     */

+    Chassis getChassisByClli(String clli);

+

+    /**

+     *

+     * @return Long

+     */

+    Long getChassisCount();

+

+    List<Chassis> getByPnfId(String pnfId);

+

+    List<Chassis> getAllChassis();

+

+/*

+oltSlot Related Functionality

+---------------------------------------------------------------------------------------

+*/

+

+    /**

+     *

+     *

+     * @param oltSlot

+     * @param chassis

+     */

+    OLTSlot addOLTSlot(OLTSlot oltSlot, Chassis chassis);

+

+    /**

+     *

+     * @param id

+     */

+    void deleteOLTSlot(Long id);

+

+    /**

+     *

+     * @param id

+     * @return oltSlot

+     */

+    OLTSlot getOLTSlotById(Long id);

+

+    /**

+     *

+     * @param serialNumber

+     * @return oltSlot

+     */

+    OLTSlot getOLTSlotBySerialNumber(String serialNumber);

+

+

+    /**

+     *

+     * @return all OLT slots

+     */

+    List<OLTSlot> getAllOLTSlots();

+

+/*

+OLTPort Related Functionality

+---------------------------------------------------------------------------------------

+*/

+

+    /**

+     *

+     * @param id

+     */

+    void deleteOLTPort(Long id);

+

+    /**

+     *

+     * @param id

+     * @return OLTPort

+     */

+    OLTPort getOLTPortById(Long id);

+

+/*

+ONTDevice Related Functionality

+---------------------------------------------------------------------------------------

+*/

+

+    /**

+     *

+     * @param clli

+     * @param slotNumber

+     * @param portNumber

+     * @param serialNumber

+     */

+    ONTDevice addONTDevice(String clli, int slotNumber, int portNumber, String serialNumber);

+

+    /**

+     *

+     * @param id

+     */

+    void deleteONTDevice(Long id);

+

+    /**

+     *

+     * @param id

+     * @return ONTDevice

+     */

+    ONTDevice getONTDeviceById(Long id);

+

+    /**

+     *

+     * @param serialNumber

+     * @return ONTDevice

+     */

+    ONTDevice getONTDeviceBySerialNumber(String serialNumber);

+

+    /**

+     *

+     * @return all ONT devices

+     */

+    List<ONTDevice> getAllONTDevices();

+

+}

diff --git a/osam-core/api/src/main/java/org/onap/osam/api/service/PmConfigsService.java b/osam-core/api/src/main/java/org/onap/osam/api/service/PmConfigsService.java
new file mode 100644
index 0000000..40c7dde
--- /dev/null
+++ b/osam-core/api/src/main/java/org/onap/osam/api/service/PmConfigsService.java
@@ -0,0 +1,45 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.api.service;

+

+import org.onap.osam.model.dao.PmConfigs;

+import org.onap.osam.model.dao.PmGroupConfig;

+import org.onap.osam.model.dao.PmConfig;

+

+import java.util.List;

+

+public interface PmConfigsService extends AbstractStorageService<Long,PmConfigs>{

+

+    List<PmConfig> getPmConfigByPmConfigsId(Long pmConfigsId);

+

+    List<PmConfig> getPmConfigByPmConfigGroupId(Long pmGroupConfigsId);

+

+    void addPmGroupConfig(PmConfig pmConfig);

+

+    void addPmGroupConfig(PmGroupConfig pmGroupConfig);

+

+    void removePmConfig(Long pmConfigId);

+

+    void removeGroupPmConfig(Long pmGroupConfigId);

+

+}

diff --git a/osam-core/api/src/main/java/org/onap/osam/api/service/SubscriberService.java b/osam-core/api/src/main/java/org/onap/osam/api/service/SubscriberService.java
new file mode 100644
index 0000000..f71be56
--- /dev/null
+++ b/osam-core/api/src/main/java/org/onap/osam/api/service/SubscriberService.java
@@ -0,0 +1,32 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.api.service;

+

+import org.onap.osam.model.dao.Subscriber;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+public interface SubscriberService extends AbstractStorageService<Long,Subscriber> {

+    Subscriber getBySubscriberIdentifier(String userIdentifier);

+}

diff --git a/osam-core/common/pom.xml b/osam-core/common/pom.xml
new file mode 100644
index 0000000..8c0fc70
--- /dev/null
+++ b/osam-core/common/pom.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!--/*-

+        * ============LICENSE_START=======================================================

+        * OSAM Core

+        * ================================================================================

+        * Copyright (C) 2018 Netsia

+        * ================================================================================

+        * 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.

+        * ============LICENSE_END=========================================================

+        */-->

+

+<project xmlns="http://maven.apache.org/POM/4.0.0"

+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

+    <parent>

+        <artifactId>osam-core</artifactId>

+        <groupId>org.onap.osam</groupId>

+        <version>0.0.1-SNAPSHOT</version>

+    </parent>

+    <modelVersion>4.0.0</modelVersion>

+    <artifactId>common</artifactId>

+

+

+</project>
\ No newline at end of file
diff --git a/osam-core/common/src/main/java/org/onap/osam/common/exception/BadFormatException.java b/osam-core/common/src/main/java/org/onap/osam/common/exception/BadFormatException.java
new file mode 100644
index 0000000..3bab403
--- /dev/null
+++ b/osam-core/common/src/main/java/org/onap/osam/common/exception/BadFormatException.java
@@ -0,0 +1,33 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.common.exception;

+

+

+/**

+ * Created by cemturker on 19.09.2018.

+ */

+public class BadFormatException extends RuntimeException {

+    public BadFormatException(String message) {

+        super(message);

+    }

+}

diff --git a/osam-core/common/src/main/java/org/onap/osam/common/exception/InvalidOperationException.java b/osam-core/common/src/main/java/org/onap/osam/common/exception/InvalidOperationException.java
new file mode 100644
index 0000000..7ac9547
--- /dev/null
+++ b/osam-core/common/src/main/java/org/onap/osam/common/exception/InvalidOperationException.java
@@ -0,0 +1,32 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.common.exception;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+public class InvalidOperationException extends RuntimeException {

+    public InvalidOperationException(String message) {

+        super(message);

+    }

+}

diff --git a/osam-core/common/src/main/java/org/onap/osam/common/exception/NotFoundException.java b/osam-core/common/src/main/java/org/onap/osam/common/exception/NotFoundException.java
new file mode 100644
index 0000000..e850c43
--- /dev/null
+++ b/osam-core/common/src/main/java/org/onap/osam/common/exception/NotFoundException.java
@@ -0,0 +1,33 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.common.exception;

+

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+public class NotFoundException extends RuntimeException {

+    public NotFoundException(String message) {

+        super(message);

+    }

+}

diff --git a/osam-core/common/src/main/java/org/onap/osam/common/exception/UnknownTypeException.java b/osam-core/common/src/main/java/org/onap/osam/common/exception/UnknownTypeException.java
new file mode 100644
index 0000000..7b13329
--- /dev/null
+++ b/osam-core/common/src/main/java/org/onap/osam/common/exception/UnknownTypeException.java
@@ -0,0 +1,33 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.common.exception;

+

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+public class UnknownTypeException extends RuntimeException {

+    public UnknownTypeException(String message) {

+        super(message);

+    }

+}

diff --git a/osam-core/core/pom.xml b/osam-core/core/pom.xml
new file mode 100644
index 0000000..1db7193
--- /dev/null
+++ b/osam-core/core/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!--/*-

+        * ============LICENSE_START=======================================================

+        * OSAM Core

+        * ================================================================================

+        * Copyright (C) 2018 Netsia

+        * ================================================================================

+        * 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.

+        * ============LICENSE_END=========================================================

+        */-->

+

+<project xmlns="http://maven.apache.org/POM/4.0.0"

+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

+    <parent>

+        <artifactId>osam-core</artifactId>

+        <groupId>org.onap.osam</groupId>

+        <version>0.0.1-SNAPSHOT</version>

+    </parent>

+    <modelVersion>4.0.0</modelVersion>

+    <artifactId>core</artifactId>

+    <dependencies>

+        <dependency>

+            <groupId>org.onap.osam</groupId>

+            <artifactId>external</artifactId>

+            <version>${project.version}</version>

+        </dependency>

+    </dependencies>

+</project>
\ No newline at end of file
diff --git a/osam-core/core/src/main/java/org/onap/osam/core/AbstractBaseServiceImpl.java b/osam-core/core/src/main/java/org/onap/osam/core/AbstractBaseServiceImpl.java
new file mode 100644
index 0000000..ef69df9
--- /dev/null
+++ b/osam-core/core/src/main/java/org/onap/osam/core/AbstractBaseServiceImpl.java
@@ -0,0 +1,72 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.core;

+

+import org.onap.osam.common.exception.NotFoundException;

+import org.onap.osam.model.dao.BaseEntity;

+import org.slf4j.Logger;

+import org.slf4j.LoggerFactory;

+import org.springframework.data.repository.CrudRepository;

+

+import java.util.ArrayList;

+import java.util.Collections;

+import java.util.List;

+import java.util.Optional;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+

+public abstract class AbstractBaseServiceImpl {

+

+    protected Logger log = LoggerFactory.getLogger(this.getClass());

+

+    protected <T extends BaseEntity> T add(T t, CrudRepository<T, Long> repository) {

+        t = repository.save(t);

+        log.info("{} is added",t);

+        return t;

+    }

+

+    protected <T extends BaseEntity> void remove(Long id, CrudRepository<T, Long> repository, Class classz) {

+        repository.deleteById(id);

+        log.info("{} is deleted for {}", id, classz.getName());

+    }

+

+    protected <T extends BaseEntity> T get(Long id, CrudRepository<T, Long> repository) {

+        Optional<T> optional = repository.findById(id);

+        if (!optional.isPresent()) {

+            throw new NotFoundException("id:"+id+" is not found");

+        }

+        return optional.get();

+    }

+

+    protected <T extends BaseEntity> List<T> getAll(CrudRepository<T, Long> repository) {

+        List<T> ts = new ArrayList<>();

+        repository.findAll().iterator().forEachRemaining(ts::add);

+        return Collections.unmodifiableList(ts);

+    }

+

+    protected <T extends BaseEntity> Long count(CrudRepository<T, Long> repository) {

+        return repository.count();

+    }

+}

diff --git a/osam-core/core/src/main/java/org/onap/osam/core/AccessPodServiceImpl.java b/osam-core/core/src/main/java/org/onap/osam/core/AccessPodServiceImpl.java
new file mode 100644
index 0000000..b3e00c5
--- /dev/null
+++ b/osam-core/core/src/main/java/org/onap/osam/core/AccessPodServiceImpl.java
@@ -0,0 +1,95 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.core;

+

+import org.onap.osam.external.aai.AaiClient;

+import org.onap.osam.external.aai.model.PNF;

+import org.onap.osam.model.dao.AccessPod;

+import org.onap.osam.common.exception.NotFoundException;

+import org.onap.osam.model.repository.AccessPodRepository;

+import org.onap.osam.api.service.AccessPodService;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.stereotype.Service;

+

+import java.util.List;

+import java.util.Optional;

+

+/**

+ * Created by cemturker on 26.09.2018.

+ */

+@Service

+public class AccessPodServiceImpl extends AbstractBaseServiceImpl implements AccessPodService {

+

+    private AccessPodRepository accessPodRepository;

+

+    private AaiClient aaiClient;

+

+    @Autowired

+    public AccessPodServiceImpl(AccessPodRepository accessPodRepository, AaiClient aaiClient) {

+        this.accessPodRepository = accessPodRepository;

+        this.aaiClient = aaiClient;

+    }

+

+

+    @Override

+    public AccessPod addOrUpdate(AccessPod value) {

+        PNF pnf = aaiClient.queryPnf(value.getPnfId());

+        Optional<AccessPod> accessPodOptional = accessPodRepository.findByPnfId(pnf.getPnfId());

+        if (accessPodOptional.isPresent()) {

+            AccessPod tmp = accessPodOptional.get();

+            value.setId(tmp.getId());

+        }

+        add(value,accessPodRepository);

+        //TODO need to update connection to grpc!!

+        return value;

+    }

+

+    @Override

+    public void removeById(Long key) {

+        remove(key,accessPodRepository,AccessPod.class);

+    }

+

+    @Override

+    public AccessPod getById(Long key) {

+        return get(key,accessPodRepository);

+    }

+

+    @Override

+    public List<AccessPod> getAll() {

+        return getAll(accessPodRepository);

+    }

+

+    @Override

+    public AccessPod findByPnfId(String pnfId) {

+        Optional<AccessPod> accessPodOp = accessPodRepository.findByPnfId(pnfId);

+        if (!accessPodOp.isPresent()) {

+            throw new NotFoundException("pnfId:"+pnfId+ " is not found");

+        }

+        return accessPodOp.get();

+    }

+

+    @Override

+    public void removeByPnfId(String pnfId) {

+        accessPodRepository.removeByPnfId(pnfId);

+    }

+}

diff --git a/osam-core/core/src/main/java/org/onap/osam/core/AlarmServiceImpl.java b/osam-core/core/src/main/java/org/onap/osam/core/AlarmServiceImpl.java
new file mode 100644
index 0000000..57aa5f1
--- /dev/null
+++ b/osam-core/core/src/main/java/org/onap/osam/core/AlarmServiceImpl.java
@@ -0,0 +1,78 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.core;

+

+import org.onap.osam.model.dao.AlarmsAndEvents;

+import org.onap.osam.api.service.AlarmService;

+import org.onap.osam.common.exception.UnknownTypeException;

+import org.onap.osam.model.dao.ActiveAlarmsAndEvents;

+import org.onap.osam.model.dao.HistoricalAlarmsAndEvents;

+import org.onap.osam.model.repository.ActiveAlarmsAndEventsRepository;

+import org.onap.osam.model.repository.HistoricalAlarmsAndEventsRepository;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.stereotype.Service;

+

+import java.util.Date;

+import java.util.List;

+

+@Service

+public class AlarmServiceImpl extends AbstractBaseServiceImpl implements AlarmService {

+

+    ActiveAlarmsAndEventsRepository activeAlarmsAndEventsRepository;

+    HistoricalAlarmsAndEventsRepository historicalAlarmsAndEventsRepository;

+

+    @Autowired

+    public AlarmServiceImpl(ActiveAlarmsAndEventsRepository activeAlarmsAndEventsRepository,

+                            HistoricalAlarmsAndEventsRepository historicalAlarmsAndEventsRepository){

+        this.activeAlarmsAndEventsRepository = activeAlarmsAndEventsRepository;

+        this.historicalAlarmsAndEventsRepository = historicalAlarmsAndEventsRepository;

+    }

+

+    @Override

+    public List<ActiveAlarmsAndEvents> getActiveAlarmsAndEventsByDate(Date startDate, Date endDate) {

+        return activeAlarmsAndEventsRepository.findAllActiveAlarmsAndEventsByDateLessThanEqualAndDateGreaterThanEqual

+                (endDate,startDate);

+    }

+

+    @Override

+    public List<HistoricalAlarmsAndEvents> getHistoricalAlarmsAndEventsByDate(Date startDate, Date endDate) {

+        return historicalAlarmsAndEventsRepository.findAllHistoricalAlarmsAndEventsByDateLessThanEqualAndDateGreaterThanEqual(endDate,startDate);

+

+    }

+

+    @Override

+    public void addOrUpdate(AlarmsAndEvents alarmsAndEvents) {

+       switch (alarmsAndEvents.getAlarmStatus()){

+           case ACTIVE:

+               add(new ActiveAlarmsAndEvents(alarmsAndEvents),activeAlarmsAndEventsRepository);

+               add(new HistoricalAlarmsAndEvents(alarmsAndEvents),historicalAlarmsAndEventsRepository);

+               break;

+           case DEACTIVE:

+               remove(alarmsAndEvents.getId(),activeAlarmsAndEventsRepository,AlarmsAndEvents.class);

+               add(new HistoricalAlarmsAndEvents(alarmsAndEvents) ,historicalAlarmsAndEventsRepository);

+               break;

+           default:

+               throw new UnknownTypeException("alarm status is unknown" + alarmsAndEvents.getAlarmStatus());

+       }

+    }

+}

diff --git a/osam-core/core/src/main/java/org/onap/osam/core/BroadBandServiceImpl.java b/osam-core/core/src/main/java/org/onap/osam/core/BroadBandServiceImpl.java
new file mode 100644
index 0000000..fa0fdbc
--- /dev/null
+++ b/osam-core/core/src/main/java/org/onap/osam/core/BroadBandServiceImpl.java
@@ -0,0 +1,115 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.core;

+

+import org.onap.osam.model.dao.SpeedProfile;

+import org.onap.osam.model.dao.Service;

+import org.onap.osam.model.dao.TechnologyProfile;

+import org.onap.osam.model.repository.ServiceRepository;

+import org.onap.osam.model.repository.SpeedProfileRepository;

+import org.onap.osam.model.repository.TechnologyProfileRepository;

+import org.onap.osam.api.service.BroadBandService;

+import org.springframework.beans.factory.annotation.Autowired;

+

+import java.util.List;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+@org.springframework.stereotype.Service

+public class BroadBandServiceImpl extends AbstractBaseServiceImpl implements BroadBandService {

+    private SpeedProfileRepository speedProfileRepository;

+    private TechnologyProfileRepository technologyProfileRepository;

+    private ServiceRepository serviceRepository;

+

+    @Autowired

+    public BroadBandServiceImpl(SpeedProfileRepository speedProfileRepository,

+                                TechnologyProfileRepository technologyProfileRepository,

+                                ServiceRepository serviceRepository) {

+        super();

+        this.speedProfileRepository = speedProfileRepository;

+        this.technologyProfileRepository = technologyProfileRepository;

+        this.serviceRepository = serviceRepository;

+    }

+

+    @Override

+    public SpeedProfile addSpeedProfile(SpeedProfile speedProfile) {

+        return add(speedProfile, speedProfileRepository);

+    }

+

+    @Override

+    public TechnologyProfile addTechnologyProfile(TechnologyProfile technologyProfile) {

+        return add(technologyProfile,technologyProfileRepository);

+    }

+

+    @Override

+    public Service addService(Service service) {

+        return add(service,serviceRepository);

+    }

+

+    @Override

+    public void removeSpeedProfile(Long id) {

+        remove(id, speedProfileRepository, SpeedProfile.class);

+

+    }

+

+    @Override

+    public void removeTechnologyProfile(Long id) {

+        remove(id, technologyProfileRepository, TechnologyProfile.class);

+    }

+

+    @Override

+    public void removeService(Long id) {

+        remove(id, serviceRepository, Service.class);

+    }

+

+    @Override

+    public SpeedProfile getSpeedProfile(Long id) {

+        return get(id, speedProfileRepository);

+    }

+

+    @Override

+    public TechnologyProfile getTechnologyProfile(Long id) {

+        return get(id, technologyProfileRepository);

+    }

+

+    @Override

+    public Service getService(Long id) {

+        return get(id, serviceRepository);

+    }

+

+    @Override

+    public List<SpeedProfile> getSpeedProfiles() {

+        return getAll(speedProfileRepository);

+    }

+

+    @Override

+    public List<TechnologyProfile> getTechnologyProfiles() {

+        return getAll(technologyProfileRepository);

+    }

+

+    @Override

+    public List<Service> getServices() {

+        return getAll(serviceRepository);

+    }

+}

diff --git a/osam-core/core/src/main/java/org/onap/osam/core/DeviceServiceImpl.java b/osam-core/core/src/main/java/org/onap/osam/core/DeviceServiceImpl.java
new file mode 100644
index 0000000..610e217
--- /dev/null
+++ b/osam-core/core/src/main/java/org/onap/osam/core/DeviceServiceImpl.java
@@ -0,0 +1,274 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.core;

+

+import com.google.common.collect.Lists;

+import org.onap.osam.api.service.AccessPodService;

+import org.onap.osam.common.exception.InvalidOperationException;

+import org.onap.osam.common.exception.NotFoundException;

+import org.onap.osam.api.service.DeviceService;

+import org.onap.osam.external.grpc.AbstractOLTClient;

+import org.onap.osam.model.dao.*;

+import org.onap.osam.model.repository.ChassisRepository;

+import org.onap.osam.model.repository.OLTPortRepository;

+import org.onap.osam.model.repository.OLTSlotRepository;

+import org.onap.osam.model.repository.ONTDeviceRepository;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.stereotype.Service;

+

+import java.util.HashSet;

+import java.util.List;

+import java.util.Optional;

+import java.util.Set;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+@Service

+public class DeviceServiceImpl extends AbstractBaseServiceImpl implements DeviceService {

+

+    private ChassisRepository chassisRepository;

+    private OLTPortRepository oltPortRepository;

+    private OLTSlotRepository oltSlotRepository;

+    private ONTDeviceRepository ontDeviceRepository;

+    private AbstractOLTClient abstractOLTClient;

+    private AccessPodService accessPodService;

+

+    public static int NUMBER_OF_OLT_PORTS   = 16;

+    public static int NUMBER_OF_ONT_DEVICES = 64;

+

+    @Autowired

+    public DeviceServiceImpl(ChassisRepository chassisRepository,

+                             OLTPortRepository oltPortRepository,

+                             OLTSlotRepository oltSlotRepository,

+                             ONTDeviceRepository ontDeviceRepository,

+                             AbstractOLTClient abstractOLTClient,

+                             AccessPodService accessPodService) {

+        this.chassisRepository = chassisRepository;

+        this.oltPortRepository = oltPortRepository;

+        this.oltSlotRepository = oltSlotRepository;

+        this.ontDeviceRepository = ontDeviceRepository;

+        this.abstractOLTClient = abstractOLTClient;

+        this.accessPodService = accessPodService;

+    }

+

+    @Override

+    public Chassis addChassis(Chassis chassis) {

+        AccessPod accessPod = accessPodService.findByPnfId(chassis.getAccessPod().getPnfId());

+        chassis.setAccessPod(accessPod);

+        String deviceId = abstractOLTClient.createChassis(chassis);

+        if (deviceId != null) {

+            return add(chassis, chassisRepository);

+        }

+        return null;

+    }

+

+    @Override

+    public void deleteChassis(Long id) {

+        remove(id, chassisRepository,Chassis.class);

+    }

+

+    public void deleteChassisByClli(String clli) {

+        Optional<Chassis> chassis = chassisRepository.findByClli(clli);

+        if (chassis.isPresent()){

+            Long id = chassis.get().getId();

+            remove(id, chassisRepository,Chassis.class);

+        }

+    }

+

+    @Override

+    public Chassis getChassisById(Long id) {

+        Optional<Chassis> chassis = chassisRepository.findById(id);

+        if (chassis.isPresent()) {

+            return chassis.get();

+        }

+        return null;

+    }

+

+    @Override

+    public Chassis getChassisByClli(String clli) {

+        Optional<Chassis> chassis = chassisRepository.findByClli(clli);

+        if (chassis.isPresent()) {

+            return chassis.get();

+        }

+        return null;

+    }

+

+    @Override

+    public Long getChassisCount() {

+        return chassisRepository.count();

+    }

+

+    @Override

+    public List<Chassis> getByPnfId(String pnfId) {

+        Optional<List<Chassis>> chassisList = chassisRepository.findByAccessPodPnfId(pnfId);

+        if (!chassisList.isPresent()) {

+            throw new NotFoundException("Chassis is not found with "+pnfId + ":pnfId");

+        }

+        return chassisList.get();

+    }

+

+    @Override

+    public List<Chassis> getAllChassis() {

+        return Lists.newArrayList(chassisRepository.findAll());

+    }

+

+    @Override

+    public OLTSlot addOLTSlot(OLTSlot oltSlot, Chassis chassis) {

+        Set<OLTSlot> oltSlots = chassis.getOltSlots();

+        int size = oltSlots.size();

+        if (size == NUMBER_OF_OLT_PORTS) {

+            throw new InvalidOperationException("Maximum number of OLTs exceeded");

+        }

+        oltSlot.setNumber(size+1);

+        oltSlot.setAdminState(AdminState.ENABLED);

+        oltSlot.setOperationalState(ActivityState.ACTIVE);

+        oltSlot.setPortAuthState(ActivityState.ACTIVE);

+        String deviceId = abstractOLTClient.createOLTChassis(oltSlot);

+        if (deviceId != null) {

+            oltSlot.setChassis(chassis);

+            add(oltSlot, oltSlotRepository);

+            for (int j = 0; j < 16 ; j++) {

+                OLTPort oltPort = new OLTPort();

+                oltPort.setOltSlot(oltSlot);

+                oltPort.setPortNumber(j+1);

+                oltPort.setAdminState(AdminState.ENABLED);

+                oltPort.setPortAuthState(ActivityState.ACTIVE);

+                add(oltPort, oltPortRepository);

+            }

+            if (oltSlots.isEmpty()) {

+                oltSlots = new HashSet<>();

+            }

+            oltSlots.add(oltSlot);

+            chassis.setOltSlots(oltSlots);

+            chassisRepository.save(chassis);

+        }

+        return oltSlot;

+    }

+

+    @Override

+    public void deleteOLTSlot(Long id) {

+        oltSlotRepository.deleteById(id);

+    }

+

+    @Override

+    public OLTSlot getOLTSlotById(Long id) {

+        Optional<OLTSlot> oltSlot = oltSlotRepository.findById(id);

+        if (oltSlot.isPresent()) {

+            return oltSlot.get();

+        }

+        return null;

+    }

+

+    @Override

+    public OLTSlot getOLTSlotBySerialNumber(String serialNumber) {

+        Optional<OLTSlot> oltSlot = oltSlotRepository.findBySerialNumber(serialNumber);

+        if (oltSlot.isPresent()) {

+            return oltSlot.get();

+        }

+        return null;

+    }

+

+    @Override

+    public List<OLTSlot> getAllOLTSlots() {

+        return Lists.newArrayList(oltSlotRepository.findAll());

+    }

+

+    @Override

+    public void deleteOLTPort(Long id) {

+        oltPortRepository.deleteById(id);

+    }

+

+    @Override

+    public OLTPort getOLTPortById(Long id) {

+        Optional<OLTPort> oltPort = oltPortRepository.findById(id);

+        if (oltPort.isPresent()) {

+            return oltPort.get();

+        }

+        return null;

+    }

+

+    @Override

+    public ONTDevice addONTDevice(String clli, int slotNumber, int portNumber, String serialNumber){

+        ONTDevice ont = null;

+        Optional<OLTPort> thePort = oltPortRepository.findByPortNumberAndOltSlot_NumberAndOltSlot_ChassisClli(portNumber,slotNumber,clli);

+        if (thePort.isPresent()) {

+            OLTPort port = thePort.get();

+            log.info("Port found : {}", thePort);

+            Set<ONTDevice> ontDevices = port.getOntDevices();

+            int size = ontDevices.size();

+            if (size == NUMBER_OF_ONT_DEVICES) {

+                throw new InvalidOperationException("Maximum number of ONTs exceeded");

+            }

+            int ontNumber = size+1;

+            boolean result =  abstractOLTClient.provisionONT(clli, slotNumber, portNumber,ontNumber,serialNumber);

+            if (result){

+                ont = new ONTDevice();

+                ont.setSerialNumber(serialNumber);

+                ont.setNumber(ontNumber);

+                ont.setOLTPort(port);

+                ont.setAdminState(AdminState.ENABLED);

+                ont.setOperationalState(ActivityState.ACTIVE);

+                ont.setPortAuthState(ActivityState.ACTIVE);

+                add(ont,ontDeviceRepository);

+                ontDevices.add(ont);

+                oltPortRepository.save(port);

+            } else {

+                log.error("Error rpc failed");

+                throw new NotFoundException("Operation failed");

+            }

+        } else {

+            log.error("Port not found");

+            throw new NotFoundException("Operation failed");

+        }

+        return ont;

+    }

+

+    @Override

+    public void deleteONTDevice(Long id) {

+        ontDeviceRepository.deleteById(id);

+    }

+

+    @Override

+    public ONTDevice getONTDeviceById(Long id) {

+        Optional<ONTDevice> ontDevice = ontDeviceRepository.findById(id);

+        if (ontDevice.isPresent()) {

+            ontDevice.get();

+        }

+        return null;

+    }

+

+    @Override

+    public ONTDevice getONTDeviceBySerialNumber(String serialNumber) {

+        Optional<ONTDevice> ontDevice = ontDeviceRepository.findBySerialNumber(serialNumber);

+        if (ontDevice.isPresent()) {

+            ontDevice.get();

+        }

+        return null;

+    }

+

+    @Override

+    public List<ONTDevice> getAllONTDevices() {

+        return Lists.newArrayList(ontDeviceRepository.findAll());

+    }

+}

diff --git a/osam-core/core/src/main/java/org/onap/osam/core/PmConfigsServiceImpl.java b/osam-core/core/src/main/java/org/onap/osam/core/PmConfigsServiceImpl.java
new file mode 100644
index 0000000..b1e3f29
--- /dev/null
+++ b/osam-core/core/src/main/java/org/onap/osam/core/PmConfigsServiceImpl.java
@@ -0,0 +1,104 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.core;

+

+import org.onap.osam.model.repository.PmConfigsRepository;

+import org.onap.osam.model.dao.PmConfig;

+import org.onap.osam.model.dao.PmConfigs;

+import org.onap.osam.model.dao.PmGroupConfig;

+import org.onap.osam.model.repository.PmConfigRepository;

+import org.onap.osam.model.repository.PmGroupConfigRepository;

+import org.onap.osam.api.service.PmConfigsService;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.stereotype.Service;

+

+import java.util.List;

+

+@Service

+public class PmConfigsServiceImpl extends AbstractBaseServiceImpl implements PmConfigsService{

+

+    protected PmConfigRepository pmConfigRepository;

+    protected PmConfigsRepository pmConfigsRepository;

+    protected PmGroupConfigRepository pmGroupConfigRepository;

+

+    @Autowired

+    public PmConfigsServiceImpl(PmConfigRepository pmConfigRepository,PmConfigsRepository pmConfigsRepository,

+                                PmGroupConfigRepository pmGroupConfigRepository){

+

+        this.pmConfigRepository=pmConfigRepository;

+        this.pmGroupConfigRepository=pmGroupConfigRepository;

+        this.pmConfigsRepository=pmConfigsRepository;

+    }

+

+

+    @Override

+    public List<PmConfig> getPmConfigByPmConfigsId(Long pmConfigsId) {

+        return pmConfigRepository.getByPmConfigs_Id(pmConfigsId);

+    }

+

+    @Override

+    public List<PmConfig> getPmConfigByPmConfigGroupId(Long pmGroupConfigsId) {

+        return pmConfigRepository.getByPmGroupConfig_Id(pmGroupConfigsId);

+    }

+

+    @Override

+    public void addPmGroupConfig(PmConfig pmConfig) {

+        add(pmConfig,pmConfigRepository);

+    }

+

+    @Override

+    public void addPmGroupConfig(PmGroupConfig pmGroupConfig) {

+        add(pmGroupConfig,pmGroupConfigRepository);

+    }

+

+    @Override

+    public void removePmConfig(Long pmConfigId) {

+        remove(pmConfigId,pmConfigRepository,PmConfig.class);

+    }

+

+    @Override

+    public void removeGroupPmConfig(Long pmGroupConfigId) {

+        remove(pmGroupConfigId,pmGroupConfigRepository,PmGroupConfig.class);

+    }

+

+

+    @Override

+    public PmConfigs addOrUpdate(PmConfigs value) {

+        return add(value,pmConfigsRepository);

+    }

+

+    @Override

+    public void removeById(Long key) {

+        remove(key,pmConfigsRepository,PmConfigs.class);

+    }

+

+    @Override

+    public PmConfigs getById(Long key) {

+        return get(key,pmConfigsRepository);

+    }

+

+    @Override

+    public List<PmConfigs> getAll() {

+        return getAll(pmConfigsRepository);

+    }

+}

diff --git a/osam-core/core/src/main/java/org/onap/osam/core/SubscriberServiceImpl.java b/osam-core/core/src/main/java/org/onap/osam/core/SubscriberServiceImpl.java
new file mode 100644
index 0000000..e295655
--- /dev/null
+++ b/osam-core/core/src/main/java/org/onap/osam/core/SubscriberServiceImpl.java
@@ -0,0 +1,71 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.core;

+

+import org.onap.osam.model.dao.Subscriber;

+import org.onap.osam.model.repository.SubscriberRepository;

+import org.onap.osam.api.service.SubscriberService;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.stereotype.Service;

+

+import java.util.List;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+@Service

+public class SubscriberServiceImpl extends AbstractBaseServiceImpl implements SubscriberService {

+

+    private SubscriberRepository subscriberRepository;

+

+    @Autowired

+    public SubscriberServiceImpl(SubscriberRepository subscriberRepository) {

+        this.subscriberRepository = subscriberRepository;

+    }

+

+    @Override

+    public Subscriber addOrUpdate(Subscriber subscriber) {

+        //TODO Add Check the devices.....

+        return add(subscriber, subscriberRepository);

+    }

+

+    @Override

+    public void removeById(Long id) {

+        remove(id, subscriberRepository, Subscriber.class);

+    }

+

+    @Override

+    public Subscriber getById(Long id) {

+        return get(id, subscriberRepository);

+    }

+

+    @Override

+    public List<Subscriber> getAll() {

+        return getAll(subscriberRepository);

+    }

+

+    @Override

+    public Subscriber getBySubscriberIdentifier(String userIdentifier) {

+        return subscriberRepository.findByUserIdentifier(userIdentifier);

+    }

+}

diff --git a/osam-core/external/pom.xml b/osam-core/external/pom.xml
new file mode 100644
index 0000000..dd70a2c
--- /dev/null
+++ b/osam-core/external/pom.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!--/*-

+        * ============LICENSE_START=======================================================

+        * OSAM Core

+        * ================================================================================

+        * Copyright (C) 2018 Netsia

+        * ================================================================================

+        * 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.

+        * ============LICENSE_END=========================================================

+        */-->

+

+<project xmlns="http://maven.apache.org/POM/4.0.0"

+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

+    <parent>

+        <artifactId>osam-core</artifactId>

+        <groupId>org.onap.osam</groupId>

+        <version>0.0.1-SNAPSHOT</version>

+    </parent>

+    <modelVersion>4.0.0</modelVersion>

+

+    <artifactId>external</artifactId>

+

+    <repositories>

+        <repository>

+            <id>jcenter</id>

+            <url>https://jcenter.bintray.com/</url>

+        </repository>

+    </repositories>

+    <dependencies>

+        <dependency>

+            <groupId>org.springframework</groupId>

+            <artifactId>spring-webflux</artifactId>

+        </dependency>

+        <dependency>

+            <groupId>org.springframework.boot</groupId>

+            <artifactId>spring-boot-starter-reactor-netty</artifactId>

+        </dependency>

+        <dependency>

+            <groupId>org.lognet</groupId>

+            <artifactId>grpc-spring-boot-starter</artifactId>

+            <version>${grpc-spring-boot-starter.version}</version>

+        </dependency>

+        <dependency>

+            <groupId>org.onap.osam</groupId>

+            <artifactId>api</artifactId>

+            <version>${project.version}</version>

+        </dependency>

+        <dependency>

+            <groupId>com.google.guava</groupId>

+            <artifactId>guava</artifactId>

+            <version>${guava.version}</version>

+        </dependency>

+    </dependencies>

+    <pluginRepositories>

+        <pluginRepository>

+            <releases>

+                <updatePolicy>never</updatePolicy>

+            </releases>

+            <snapshots>

+                <enabled>false</enabled>

+            </snapshots>

+            <id>central</id>

+            <name>Central Repository</name>

+            <url>https://repo.maven.apache.org/maven2</url>

+        </pluginRepository>

+        <pluginRepository>

+            <id>protoc-plugin</id>

+            <url>https://dl.bintray.com/sergei-ivanov/maven/</url>

+        </pluginRepository>

+    </pluginRepositories>

+

+    <build>

+        <extensions>

+            <extension>

+                <groupId>kr.motd.maven</groupId>

+                <artifactId>os-maven-plugin</artifactId>

+                <version>${os-maven-plugin.version}</version>

+            </extension>

+        </extensions>

+        <plugins>

+            <!-- protobuf-maven-plugin -->

+            <plugin>

+                <groupId>org.xolstice.maven.plugins</groupId>

+                <artifactId>protobuf-maven-plugin</artifactId>

+                <version>${protobuf-maven-plugin.version}</version>

+                <configuration>

+                    <protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>

+                    <pluginId>grpc-java</pluginId>

+                    <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.11.0:exe:${os.detected.classifier}</pluginArtifact>

+                </configuration>

+                <executions>

+                    <execution>

+                        <goals>

+                            <goal>compile</goal>

+                            <goal>compile-custom</goal>

+                        </goals>

+                    </execution>

+                </executions>

+            </plugin>

+        </plugins>

+    </build>

+</project>
\ No newline at end of file
diff --git a/osam-core/external/src/main/java/org/onap/osam/external/aai/AaiClient.java b/osam-core/external/src/main/java/org/onap/osam/external/aai/AaiClient.java
new file mode 100644
index 0000000..2f7c7fd
--- /dev/null
+++ b/osam-core/external/src/main/java/org/onap/osam/external/aai/AaiClient.java
@@ -0,0 +1,36 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.external.aai;

+

+import org.onap.osam.external.aai.model.PNF;

+

+import javax.net.ssl.SSLException;

+import java.io.IOException;

+

+/**

+ * Created by cemturker on 26.09.2018.

+ */

+public interface AaiClient {

+    PNF queryPnf(String name);

+    void putPnf(PNF pnf);

+}

diff --git a/osam-core/external/src/main/java/org/onap/osam/external/aai/AaiClientImpl.java b/osam-core/external/src/main/java/org/onap/osam/external/aai/AaiClientImpl.java
new file mode 100644
index 0000000..066f109
--- /dev/null
+++ b/osam-core/external/src/main/java/org/onap/osam/external/aai/AaiClientImpl.java
@@ -0,0 +1,97 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.external.aai;

+

+import lombok.extern.slf4j.Slf4j;

+import org.onap.osam.common.exception.BadFormatException;

+import org.onap.osam.common.exception.InvalidOperationException;

+import org.onap.osam.common.exception.NotFoundException;

+import org.onap.osam.external.aai.config.AaiConfig;

+import org.onap.osam.external.aai.exception.ExternalSystemException;

+import org.onap.osam.external.aai.model.PNF;

+import org.onap.osam.external.aai.util.AaiHeaderUtil;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.HttpStatus;

+import org.springframework.stereotype.Service;

+import org.springframework.web.reactive.function.client.ClientResponse;

+

+import javax.net.ssl.SSLException;

+

+

+/**

+ * Created by cemturker on 12.04.2018.

+ */

+

+@Service

+@Slf4j

+public class AaiClientImpl implements AaiClient {

+

+    private AaiConfig aaiConfig;

+

+    @Autowired

+    public AaiClientImpl(AaiConfig aaiConfig) {

+        this.aaiConfig = aaiConfig;

+    }

+

+    @Override

+    public PNF queryPnf(String name) {

+        try {

+            ClientResponse response = AaiWebClient.webClient(aaiConfig).build().queryPNF(name);

+            commonErrorCheck(name,response);

+            log.info("Pnf query response code {} for {} id",response.statusCode(),name);

+            if (response.statusCode().is2xxSuccessful()) {

+                return AaiHeaderUtil.convertToPnf(response.bodyToMono(String.class).block());

+            }

+        } catch (SSLException e) {

+            log.error("",e);

+        }

+        throw new InvalidOperationException("");

+    }

+

+    @Override

+    public void putPnf(PNF pnf) {

+        try {

+            ClientResponse response = AaiWebClient.webClient(aaiConfig).build().putPNF(pnf);

+            commonErrorCheck(pnf,response);

+            log.info("Pnf query response code {} for {} ",response.statusCode(),pnf);

+            if (response.statusCode().is2xxSuccessful()) {

+                return;

+            }

+        } catch (SSLException e) {

+            log.error("",e);

+        }

+        throw new InvalidOperationException("");

+    }

+

+    private <T> void commonErrorCheck(T t, ClientResponse response){

+        if (response.statusCode().is5xxServerError()) {

+            throw new ExternalSystemException("Aai error code:"+response.statusCode().value());

+        }

+        if (HttpStatus.BAD_REQUEST.equals(response.statusCode())) {

+            throw new BadFormatException("Bad format exception is received from AAI");

+        }

+        if (HttpStatus.NOT_FOUND.equals(response.statusCode())) {

+            throw new NotFoundException(t+" is not found in AAI");

+        }

+    }

+}

diff --git a/osam-core/external/src/main/java/org/onap/osam/external/aai/AaiWebClient.java b/osam-core/external/src/main/java/org/onap/osam/external/aai/AaiWebClient.java
new file mode 100644
index 0000000..d548715
--- /dev/null
+++ b/osam-core/external/src/main/java/org/onap/osam/external/aai/AaiWebClient.java
@@ -0,0 +1,97 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.external.aai;

+

+import io.netty.handler.ssl.SslContext;

+import io.netty.handler.ssl.SslContextBuilder;

+import io.netty.handler.ssl.util.InsecureTrustManagerFactory;

+import lombok.extern.slf4j.Slf4j;

+import org.onap.osam.external.aai.config.AaiConfig;

+import org.onap.osam.external.aai.model.PNF;

+import org.onap.osam.external.aai.util.AaiHeaderUtil;

+import org.springframework.http.client.reactive.ReactorClientHttpConnector;

+import org.springframework.web.reactive.function.client.ClientResponse;

+import org.springframework.web.reactive.function.client.WebClient;

+import org.springframework.web.util.DefaultUriBuilderFactory;

+import reactor.core.publisher.Mono;

+

+import javax.net.ssl.SSLException;

+import java.net.URI;

+

+import static org.springframework.web.reactive.function.client.ExchangeFilterFunctions.basicAuthentication;

+

+/**

+ * Created by cemturker on 01.10.2018.

+ */

+@Slf4j

+public class AaiWebClient {

+    private AaiConfig config;

+    private WebClient webClient;

+    private AaiWebClient(AaiConfig config) {

+        this.config = config;

+    }

+

+    public static AaiWebClient webClient(AaiConfig config) {

+        return new AaiWebClient(config);

+    }

+

+    public AaiWebClient build() throws SSLException {

+        SslContext sslContext;

+        sslContext = SslContextBuilder

+                .forClient()

+                .trustManager(InsecureTrustManagerFactory.INSTANCE)

+                .build();

+        log.debug("Setting ssl context");

+

+        this.webClient =  WebClient.builder()

+                .clientConnector(new ReactorClientHttpConnector(clientOptions -> {

+                    clientOptions.sslContext(sslContext);

+                    clientOptions.disablePool();

+                }))

+                .defaultHeaders(httpHeaders -> httpHeaders.setAll(AaiHeaderUtil.headers()))

+                .filter(basicAuthentication(config.getUsername(), config.getPassword()))

+                .build();

+        return this;

+    }

+

+    public ClientResponse queryPNF(String pnfId) {

+        return this.webClient.get().uri(getUri(pnfId)).exchange().block();

+    }

+

+    public ClientResponse putPNF(PNF pnf) {

+        String aai = AaiHeaderUtil.convertPnfToString(pnf);

+        log.debug(aai);

+        return this.webClient.put()

+                .uri(getUri(pnf.getPnfName()))

+                .body(Mono.just(aai),String.class)

+                .exchange().block();

+    }

+

+    private URI getUri(String pnfName) {

+        return new DefaultUriBuilderFactory().builder().scheme(config.getProtocol())

+                .host(config.getHost()).port(config.getPort())

+                .path(config.getBasePath() + config.getPnfPath() + "/" + pnfName).build();

+    }

+

+

+}

diff --git a/osam-core/external/src/main/java/org/onap/osam/external/aai/config/AaiConfig.java b/osam-core/external/src/main/java/org/onap/osam/external/aai/config/AaiConfig.java
new file mode 100644
index 0000000..08ee7e7
--- /dev/null
+++ b/osam-core/external/src/main/java/org/onap/osam/external/aai/config/AaiConfig.java
@@ -0,0 +1,66 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.external.aai.config;

+

+import lombok.Getter;

+import lombok.Setter;

+import lombok.extern.slf4j.Slf4j;

+import org.springframework.beans.factory.annotation.Value;

+import org.springframework.context.annotation.Configuration;

+import org.springframework.context.annotation.PropertySource;

+

+/**

+ * Created by cemturker on 12.04.2018.

+ */

+@Configuration

+@PropertySource("classpath:aai.properties")

+@Slf4j

+@Getter

+@Setter

+public class AaiConfig {

+    private static final String AAI_HOST = "${aai.host}";

+    private static final String AAI_PORT = "${aai.port}";

+

+    private static final String AAI_PROTOCOL = "${aai.protocol}";

+

+    private static final String AAI_USERNAME = "${aai.username}";

+    private static final String AAI_PASSWORD = "${aai.password}";

+    private static final String AAI_BASE_PATH = "${aai.base.path}";

+    private static final String AAI_PNF_PATH = "${aai.pnf.path}";

+

+    @Value(AAI_HOST)

+    private String host;

+    @Value(AAI_PORT)

+    private int port;

+    @Value(AAI_PROTOCOL)

+    private String protocol;

+    @Value(AAI_USERNAME)

+    private String username;

+    @Value(AAI_PASSWORD)

+    private String password;

+    @Value(AAI_BASE_PATH)

+    private String basePath;

+    @Value(AAI_PNF_PATH)

+    private String pnfPath;

+

+}

diff --git a/osam-core/external/src/main/java/org/onap/osam/external/aai/exception/ExternalSystemException.java b/osam-core/external/src/main/java/org/onap/osam/external/aai/exception/ExternalSystemException.java
new file mode 100644
index 0000000..157539e
--- /dev/null
+++ b/osam-core/external/src/main/java/org/onap/osam/external/aai/exception/ExternalSystemException.java
@@ -0,0 +1,32 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.external.aai.exception;

+

+/**

+ * Created by cemturker on 26.09.2018.

+ */

+public class ExternalSystemException extends RuntimeException {

+    public ExternalSystemException(String message) {

+        super(message);

+    }

+}

diff --git a/osam-core/external/src/main/java/org/onap/osam/external/aai/model/PNF.java b/osam-core/external/src/main/java/org/onap/osam/external/aai/model/PNF.java
new file mode 100644
index 0000000..63b9042
--- /dev/null
+++ b/osam-core/external/src/main/java/org/onap/osam/external/aai/model/PNF.java
@@ -0,0 +1,51 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.external.aai.model;

+

+import com.google.gson.annotations.SerializedName;

+import lombok.Getter;

+import lombok.Setter;

+

+/**

+ * Created by cemturker on 26.09.2018.

+ */

+@Setter

+@Getter

+public class PNF {

+    @SerializedName("pnf-id")

+    private String pnfId;

+    @SerializedName("pnf-name")

+    private String pnfName;

+    @SerializedName("ipaddress-v4-oam")

+    private String ipaddressV4Oam;

+

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("PNF{");

+        sb.append("pnfName='").append(pnfName).append('\'');

+        sb.append(", pnfId='").append(pnfId).append('\'');

+        sb.append(", ipaddressV4Oam='").append(ipaddressV4Oam).append('\'');

+        sb.append('}');

+        return sb.toString();

+    }

+}

diff --git a/osam-core/external/src/main/java/org/onap/osam/external/aai/util/AaiHeaderUtil.java b/osam-core/external/src/main/java/org/onap/osam/external/aai/util/AaiHeaderUtil.java
new file mode 100644
index 0000000..526a59f
--- /dev/null
+++ b/osam-core/external/src/main/java/org/onap/osam/external/aai/util/AaiHeaderUtil.java
@@ -0,0 +1,64 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.external.aai.util;

+

+import com.google.common.collect.ImmutableMap;

+import com.google.gson.Gson;

+import com.google.gson.GsonBuilder;

+import org.onap.osam.external.aai.model.PNF;

+import org.slf4j.Logger;

+import org.slf4j.LoggerFactory;

+import org.springframework.http.MediaType;

+

+

+import java.util.Map;

+

+/**

+ * Created by cemturker on 12.04.2018.

+ */

+public class AaiHeaderUtil {

+    private static final Logger logger = LoggerFactory.getLogger(AaiHeaderUtil.class);

+    private static final String X_FROM_APP_ID = "X-FromAppId";

+    private static final String X_TRANSACTION_ID = "X-TransactionId";

+    private static final String ACCEPT = "Accept";

+    private static final String CONTENT_TYPE = "Content-Type";

+    private AaiHeaderUtil(){}

+

+    public static Map<String, String> headers() {

+        return new ImmutableMap.Builder<String, String>()

+                .put(X_FROM_APP_ID,"OSAM")

+                .put(X_TRANSACTION_ID,"99")

+                .put(ACCEPT, MediaType.APPLICATION_JSON_VALUE)

+                .put(CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)

+                .build();

+    }

+

+    public static PNF convertToPnf(String body) {

+        return new Gson().fromJson(body, PNF.class);

+    }

+

+    public static String convertPnfToString(PNF pnf) {

+        GsonBuilder gsonBuilder = new GsonBuilder();

+        return gsonBuilder.create().toJson(pnf, PNF.class);

+    }

+}

diff --git a/osam-core/external/src/main/java/org/onap/osam/external/grpc/AbstractOLTClient.java b/osam-core/external/src/main/java/org/onap/osam/external/grpc/AbstractOLTClient.java
new file mode 100644
index 0000000..688f00a
--- /dev/null
+++ b/osam-core/external/src/main/java/org/onap/osam/external/grpc/AbstractOLTClient.java
@@ -0,0 +1,184 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+/*

+ * Copyright 2015, Google Inc. All rights reserved.

+ *

+ * Redistribution and use in source and binary forms, with or without

+ * modification, are permitted provided that the following conditions are

+ * met:

+ *

+ *    * Redistributions of source code must retain the above copyright

+ * notice, this list of conditions and the following disclaimer.

+ *    * Redistributions in binary form must reproduce the above

+ * copyright notice, this list of conditions and the following disclaimer

+ * in the documentation and/or other materials provided with the

+ * distribution.

+ *

+ *    * Neither the name of Google Inc. nor the names of its

+ * contributors may be used to endorse or promote products derived from

+ * this software without specific prior written permission.

+ *

+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS

+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT

+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR

+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT

+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,

+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT

+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,

+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY

+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT

+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE

+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ */

+

+package org.onap.osam.external.grpc;

+

+import io.grpc.ManagedChannel;

+import io.grpc.ManagedChannelBuilder;

+import lombok.extern.slf4j.Slf4j;

+import org.onap.osam.common.exception.NotFoundException;

+import org.onap.osam.grpc.*;

+import org.onap.osam.model.dao.Chassis;

+import org.onap.osam.model.dao.OLTSlot;

+import org.springframework.beans.factory.annotation.Value;

+import org.springframework.context.annotation.PropertySource;

+import org.springframework.stereotype.Component;

+

+import javax.annotation.PostConstruct;

+

+@Component

+@PropertySource("classpath:abstractolt.properties")

+@Slf4j

+public class AbstractOLTClient {

+

+  private static final String ABSTRACTOLT_HOST = "${abstractolt.host}";

+  private static final String ABSTRACTOLT_PORT = "${abstractolt.port}";

+

+  public static int NUMBER_OF_OLT_PORTS = 16;

+

+  private AbstractOLTGrpc.AbstractOLTBlockingStub blockingStub;

+  @Value(ABSTRACTOLT_HOST)

+  private String host;

+  @Value(ABSTRACTOLT_PORT)

+  private int port;

+

+  @PostConstruct

+  private void init() {

+      ManagedChannel managedChannel = ManagedChannelBuilder

+                .forAddress(host, port).usePlaintext().build();

+

+      blockingStub = AbstractOLTGrpc.newBlockingStub(managedChannel);

+  }

+

+  /** create chassis */

+  public String createChassis(Chassis chassis) {

+

+      String deviceID = null;

+

+      log.info("createChassis begin, chassis: {}", chassis);

+

+      String clli = chassis.getClli();

+      int rack = chassis.getRack();

+      int shelf = chassis.getShelf();

+      if (chassis.getAccessPod() == null) {

+          throw new NotFoundException("Access pod not found");

+      }

+      String xosIP = chassis.getAccessPod().getCoreIp();

+      int port = Integer.parseInt(chassis.getAccessPod().getCorePort());

+      String user = chassis.getAccessPod().getUsername();

+      String pass = chassis.getAccessPod().getPassword();

+

+      AddChassisMessage request = AddChassisMessage.newBuilder()

+              .setCLLI(clli)

+              .setRack(rack)

+              .setShelf(shelf)

+              .setXOSIP(xosIP)

+              .setXOSPort(port)

+              .setXOSUser(user)

+              .setXOSPassword(pass)

+              .build();

+

+      AddChassisReturn response = blockingStub.createChassis(request);

+      deviceID = response.getDeviceID();

+      log.info("createChassis with device id : " + deviceID);

+      return deviceID;

+  }

+

+    public String createOLTChassis(OLTSlot olt) {

+

+        String deviceID = null, chassisDeviceId = null;

+

+        try {

+            log.info("createOLTChassis begin, olt:{}", olt);

+

+            String clli = olt.getChassis().getClli();

+            AddOLTChassisMessage.OltDriver oltDriver =  AddOLTChassisMessage.OltDriver.forNumber((olt.getOltDriver().ordinal()));

+            AddOLTChassisMessage.OltType oltType = AddOLTChassisMessage.OltType.forNumber((olt.getOltType().ordinal()));

+

+            AddOLTChassisMessage request = AddOLTChassisMessage.newBuilder()

+                    .setCLLI(clli)

+                    .setDriver(oltDriver)

+                    .setNumPorts(NUMBER_OF_OLT_PORTS)

+                    .setSlotPort(olt.getPort())

+                    .setSlotIP(olt.getIpAddress())

+                    .setType(oltType)

+                    .build();

+

+            AddOLTChassisReturn response = blockingStub.createOLTChassis(request);

+            deviceID = response.getDeviceID();

+            chassisDeviceId = response.getChassisDeviceID();

+            log.info("createOLTChassis with device id : {} chassisDeviceId : {}",chassisDeviceId,deviceID);

+

+        } catch (RuntimeException e) {

+            log.error("createOLTChassis RPC failed", e);

+        }

+

+        return deviceID;

+    }

+

+    public boolean provisionONT(String clli, int slotNumber, int portNumber, int ontNumber, String serialNumber) {

+

+        boolean result = false;

+

+        try {

+            log.info("provisionONT begin, clli: {}, slotNumber: {}, portNumber:{}, ontNumber:{}, serialNumber:{}", clli, slotNumber, portNumber, ontNumber, serialNumber);

+            AddOntMessage request = AddOntMessage.newBuilder()

+                    .setCLLI(clli)

+                    .setPortNumber(portNumber)

+                    .setSlotNumber(slotNumber)

+                    .setOntNumber(ontNumber)

+                    .setSerialNumber(serialNumber)

+                    .build();

+

+            AddOntReturn response = blockingStub.provisionOnt(request);

+            result = response.getSuccess();

+            log.info("provisionONT with device id : {} success : {}" + serialNumber, result);

+

+        } catch (RuntimeException e) {

+            log.error("provisionONT RPC failed", e);

+        }

+

+        return result;

+    }

+

+}

diff --git a/osam-core/external/src/main/java/org/onap/osam/external/grpc/AbstractOLTServer.java b/osam-core/external/src/main/java/org/onap/osam/external/grpc/AbstractOLTServer.java
new file mode 100644
index 0000000..39c21c7
--- /dev/null
+++ b/osam-core/external/src/main/java/org/onap/osam/external/grpc/AbstractOLTServer.java
@@ -0,0 +1,108 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+/*

+ * Copyright 2015, Google Inc. All rights reserved.

+ *

+ * Redistribution and use in source and binary forms, with or without

+ * modification, are permitted provided that the following conditions are

+ * met:

+ *

+ *    * Redistributions of source code must retain the above copyright

+ * notice, this list of conditions and the following disclaimer.

+ *    * Redistributions in binary form must reproduce the above

+ * copyright notice, this list of conditions and the following disclaimer

+ * in the documentation and/or other materials provided with the

+ * distribution.

+ *

+ *    * Neither the name of Google Inc. nor the names of its

+ * contributors may be used to endorse or promote products derived from

+ * this software without specific prior written permission.

+ *

+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS

+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT

+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR

+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT

+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,

+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT

+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,

+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY

+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT

+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE

+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ */

+

+package org.onap.osam.external.grpc;

+

+import io.grpc.stub.StreamObserver;

+import lombok.extern.slf4j.Slf4j;

+import org.lognet.springboot.grpc.GRpcService;

+import org.onap.osam.grpc.*;

+

+import java.util.UUID;

+

+/**

+ * Server that manages startup/shutdown of a {@code AbstractOLTServer} server.

+ */

+

+@GRpcService

+@Slf4j

+public class AbstractOLTServer extends AbstractOLTGrpc.AbstractOLTImplBase {

+

+    @Override

+    public void echo(EchoMessage request, StreamObserver<EchoReplyMessage> responseObserver) {

+

+    }

+

+    @Override

+    public void createChassis(AddChassisMessage request, StreamObserver<AddChassisReturn> responseObserver) {

+        AddChassisReturn response = AddChassisReturn.newBuilder()

+                .setDeviceID(request.getCLLI())

+                .build();

+        responseObserver.onNext(response);

+        responseObserver.onCompleted();

+        log.info("createChassis with clli : {}" , request.getCLLI());

+    }

+

+    @Override

+    public void createOLTChassis(AddOLTChassisMessage request, StreamObserver<AddOLTChassisReturn> responseObserver) {

+        AddOLTChassisReturn response = AddOLTChassisReturn.newBuilder()

+                .setDeviceID(UUID.randomUUID().toString())

+                .setChassisDeviceID(request.getCLLI()).build();

+        responseObserver.onNext(response);

+        responseObserver.onCompleted();

+        log.info("createOLTChassis with clli : {}" , request.getCLLI());

+    }

+

+    @Override

+    public void provisionOnt(AddOntMessage request, StreamObserver<AddOntReturn> responseObserver) {

+        AddOntReturn response = AddOntReturn.newBuilder().setSuccess(true).build();

+        responseObserver.onNext(response);

+        responseObserver.onCompleted();

+        log.info("provisionOnt success");

+    }

+

+    @Override

+    public void deleteOnt(DeleteOntMessage request, StreamObserver<DeleteOntReturn> responseObserver) {

+

+    }

+}

diff --git a/osam-core/external/src/main/proto/abstract_olt_api.proto b/osam-core/external/src/main/proto/abstract_olt_api.proto
new file mode 100644
index 0000000..ce9a322
--- /dev/null
+++ b/osam-core/external/src/main/proto/abstract_olt_api.proto
@@ -0,0 +1,149 @@
+//Copyright 2017 the original author or authors.

+//

+//  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.

+

+syntax = "proto3";

+package api;

+import "google/api/annotations.proto";

+

+option java_multiple_files = true;

+option java_package = "org.onap.osam.grpc";

+option java_outer_classname = "AbstractOLTProto";

+

+message EchoMessage{

+   string Ping =1;

+}

+message EchoReplyMessage{

+   string Pong =1;

+}

+

+message AddChassisMessage{

+   string CLLI =1;

+   string XOSIP =2;

+   int32 XOSPort=3;

+   string XOSUser=4;

+   string XOSPassword=5;

+   int32 Rack=6;

+   int32 Shelf=7;

+}

+message AddChassisReturn{

+   string DeviceID = 1;

+}

+message ChangeXOSUserPasswordMessage{

+   string CLLI =1;

+   string XOSUser=2;

+   string XOSPassword=3;

+}

+message ChangeXOSUserPasswordReturn{

+   bool Success=1;

+}

+

+message AddOLTChassisMessage{

+   string CLLI=1;

+   string SlotIP=2;

+   fixed32 SlotPort=3;

+   string Hostname=4;

+   fixed32 NumPorts = 5;

+   bool Activate = 6;

+   enum OltDriver {

+      openoltDriver= 0;

+      asfvolt16Driver=1;

+      adtranDriver=2;

+      tibitsDriver=3;

+   }

+   OltDriver Driver=7;

+   enum OltType{

+      edgecore=0;

+      adtran=1;

+      tibit=2;

+   }

+   OltType Type=8;

+

+}

+message AddOLTChassisReturn {

+   string DeviceID =1;

+   string ChassisDeviceID =2;

+}

+

+message AddOntMessage{

+   string CLLI=1;

+   int32 SlotNumber=2;

+   int32 PortNumber=3;

+   int32 OntNumber=4;

+   string SerialNumber=5;

+}

+message AddOntReturn{

+   bool Success=1;

+}

+

+message DeleteOntMessage{

+   string CLLI=1;

+   int32 SlotNumber=2;

+   int32 PortNumber=3;

+   int32 OntNumber=4;

+   string SerialNumber=5;

+}

+message DeleteOntReturn{

+   bool Success=1;

+}

+message OutputMessage{

+   string Something=1;

+}

+message OutputReturn{

+   bool Success=1;

+}

+service AbstractOLT{

+   rpc Echo(EchoMessage) returns (EchoReplyMessage){

+      option(google.api.http)={

+        post:"/v1/Echo"

+	body:"*"

+      };

+   }

+   rpc CreateChassis(AddChassisMessage) returns (AddChassisReturn) {

+      option(google.api.http) = {

+         post: "/v1/CreateAbstractChassis"

+	 body:"*"

+      };

+   }

+   rpc ChangeXOSUserPassword(ChangeXOSUserPasswordMessage) returns(ChangeXOSUserPasswordReturn){

+      option(google.api.http)={

+        post:"/v1/ChangeXOSUserPassword"

+	body:"*"

+      };

+   }

+   rpc CreateOLTChassis(AddOLTChassisMessage) returns (AddOLTChassisReturn) {

+      option(google.api.http) = {

+         post: "/v1/CreateOLTChassis"

+	 body:"*"

+      };

+   }

+   rpc ProvisionOnt(AddOntMessage) returns (AddOntReturn) {

+      option(google.api.http) = {

+         post:"/v1/ProvsionOnt"

+	 body:"*"

+      };

+   }

+   rpc DeleteOnt(DeleteOntMessage) returns (DeleteOntReturn){

+      option(google.api.http)={

+        post:"/v1/DeleteOnt"

+	body:"*"

+      };

+   }

+   rpc Output(OutputMessage)returns(OutputReturn){

+      option(google.api.http)={

+        post:"/v1/Output"

+	body:"*"

+      };

+   }

+}

+

diff --git a/osam-core/external/src/main/proto/google/api/annotations.proto b/osam-core/external/src/main/proto/google/api/annotations.proto
new file mode 100644
index 0000000..8430836
--- /dev/null
+++ b/osam-core/external/src/main/proto/google/api/annotations.proto
@@ -0,0 +1,31 @@
+// Copyright (c) 2015, Google Inc.

+//

+// 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.

+

+syntax = "proto3";

+

+package google.api;

+

+import "google/api/http.proto";

+import "google/protobuf/descriptor.proto";

+

+option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";

+option java_multiple_files = true;

+option java_outer_classname = "AnnotationsProto";

+option java_package = "com.google.api";

+option objc_class_prefix = "GAPI";

+

+extend google.protobuf.MethodOptions {

+  // See `HttpRule`.

+  HttpRule http = 72295728;

+}

diff --git a/osam-core/external/src/main/proto/google/api/http.proto b/osam-core/external/src/main/proto/google/api/http.proto
new file mode 100644
index 0000000..1c98236
--- /dev/null
+++ b/osam-core/external/src/main/proto/google/api/http.proto
@@ -0,0 +1,370 @@
+// Copyright 2018 Google LLC.

+//

+// 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.

+//

+

+syntax = "proto3";

+

+package google.api;

+

+option cc_enable_arenas = true;

+option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";

+option java_multiple_files = true;

+option java_outer_classname = "HttpProto";

+option java_package = "com.google.api";

+option objc_class_prefix = "GAPI";

+

+

+// Defines the HTTP configuration for an API service. It contains a list of

+// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method

+// to one or more HTTP REST API methods.

+message Http {

+  // A list of HTTP configuration rules that apply to individual API methods.

+  //

+  // **NOTE:** All service configuration rules follow "last one wins" order.

+  repeated HttpRule rules = 1;

+

+  // When set to true, URL path parmeters will be fully URI-decoded except in

+  // cases of single segment matches in reserved expansion, where "%2F" will be

+  // left encoded.

+  //

+  // The default behavior is to not decode RFC 6570 reserved characters in multi

+  // segment matches.

+  bool fully_decode_reserved_expansion = 2;

+}

+

+// # gRPC Transcoding

+//

+// gRPC Transcoding is a feature for mapping between a gRPC method and one or

+// more HTTP REST endpoints. It allows developers to build a single API service

+// that supports both gRPC APIs and REST APIs. Many systems, including [Google

+// APIs](https://github.com/googleapis/googleapis),

+// [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC

+// Gateway](https://github.com/grpc-ecosystem/grpc-gateway),

+// and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature

+// and use it for large scale production services.

+//

+// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies

+// how different portions of the gRPC request message are mapped to the URL

+// path, URL query parameters, and HTTP request body. It also controls how the

+// gRPC response message is mapped to the HTTP response body. `HttpRule` is

+// typically specified as an `google.api.http` annotation on the gRPC method.

+//

+// Each mapping specifies a URL path template and an HTTP method. The path

+// template may refer to one or more fields in the gRPC request message, as long

+// as each field is a non-repeated field with a primitive (non-message) type.

+// The path template controls how fields of the request message are mapped to

+// the URL path.

+//

+// Example:

+//

+//     service Messaging {

+//       rpc GetMessage(GetMessageRequest) returns (Message) {

+//         option (google.api.http) = {

+//             get: "/v1/{name=messages/*"}"

+//         };

+//       }

+//     }

+//     message GetMessageRequest {

+//       string name = 1; // Mapped to URL path.

+//     }

+//     message Message {

+//       string text = 1; // The resource content.

+//     }

+//

+// This enables an HTTP REST to gRPC mapping as below:

+//

+// HTTP | gRPC

+// -----|-----

+// `GET /v1/messages/123456`  | `GetMessage(name: "messages/123456")`

+//

+// Any fields in the request message which are not bound by the path template

+// automatically become HTTP query parameters if there is no HTTP request body.

+// For example:

+//

+//     service Messaging {

+//       rpc GetMessage(GetMessageRequest) returns (Message) {

+//         option (google.api.http) = {

+//             get:"/v1/messages/{message_id}"

+//         };

+//       }

+//     }

+//     message GetMessageRequest {

+//       message SubMessage {

+//         string subfield = 1;

+//       }

+//       string message_id = 1; // Mapped to URL path.

+//       int64 revision = 2;    // Mapped to URL query parameter `revision`.

+//       SubMessage sub = 3;    // Mapped to URL query parameter `sub.subfield`.

+//     }

+//

+// This enables a HTTP JSON to RPC mapping as below:

+//

+// HTTP | gRPC

+// -----|-----

+// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`

+//

+// Note that fields which are mapped to URL query parameters must have a

+// primitive type or a repeated primitive type or a non-repeated message type.

+// In the case of a repeated type, the parameter can be repeated in the URL

+// as `...?param=A&param=B`. In the case of a message type, each field of the

+// message is mapped to a separate parameter, such as

+// `...?foo.a=A&foo.b=B&foo.c=C`.

+//

+// For HTTP methods that allow a request body, the `body` field

+// specifies the mapping. Consider a REST update method on the

+// message resource collection:

+//

+//     service Messaging {

+//       rpc UpdateMessage(UpdateMessageRequest) returns (Message) {

+//         option (google.api.http) = {

+//           patch: "/v1/messages/{message_id}"

+//           body: "message"

+//         };

+//       }

+//     }

+//     message UpdateMessageRequest {

+//       string message_id = 1; // mapped to the URL

+//       Message message = 2;   // mapped to the body

+//     }

+//

+// The following HTTP JSON to RPC mapping is enabled, where the

+// representation of the JSON in the request body is determined by

+// protos JSON encoding:

+//

+// HTTP | gRPC

+// -----|-----

+// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`

+//

+// The special name `*` can be used in the body mapping to define that

+// every field not bound by the path template should be mapped to the

+// request body.  This enables the following alternative definition of

+// the update method:

+//

+//     service Messaging {

+//       rpc UpdateMessage(Message) returns (Message) {

+//         option (google.api.http) = {

+//           patch: "/v1/messages/{message_id}"

+//           body: "*"

+//         };

+//       }

+//     }

+//     message Message {

+//       string message_id = 1;

+//       string text = 2;

+//     }

+//

+//

+// The following HTTP JSON to RPC mapping is enabled:

+//

+// HTTP | gRPC

+// -----|-----

+// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`

+//

+// Note that when using `*` in the body mapping, it is not possible to

+// have HTTP parameters, as all fields not bound by the path end in

+// the body. This makes this option more rarely used in practice when

+// defining REST APIs. The common usage of `*` is in custom methods

+// which don't use the URL at all for transferring data.

+//

+// It is possible to define multiple HTTP methods for one RPC by using

+// the `additional_bindings` option. Example:

+//

+//     service Messaging {

+//       rpc GetMessage(GetMessageRequest) returns (Message) {

+//         option (google.api.http) = {

+//           get: "/v1/messages/{message_id}"

+//           additional_bindings {

+//             get: "/v1/users/{user_id}/messages/{message_id}"

+//           }

+//         };

+//       }

+//     }

+//     message GetMessageRequest {

+//       string message_id = 1;

+//       string user_id = 2;

+//     }

+//

+// This enables the following two alternative HTTP JSON to RPC mappings:

+//

+// HTTP | gRPC

+// -----|-----

+// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`

+// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`

+//

+// ## Rules for HTTP mapping

+//

+// 1. Leaf request fields (recursive expansion nested messages in the request

+//    message) are classified into three categories:

+//    - Fields referred by the path template. They are passed via the URL path.

+//    - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP

+//      request body.

+//    - All other fields are passed via the URL query parameters, and the

+//      parameter name is the field path in the request message. A repeated

+//      field can be represented as multiple query parameters under the same

+//      name.

+//  2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields

+//     are passed via URL path and HTTP request body.

+//  3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all

+//     fields are passed via URL path and URL query parameters.

+//

+// ### Path template syntax

+//

+//     Template = "/" Segments [ Verb ] ;

+//     Segments = Segment { "/" Segment } ;

+//     Segment  = "*" | "**" | LITERAL | Variable ;

+//     Variable = "{" FieldPath [ "=" Segments ] "}" ;

+//     FieldPath = IDENT { "." IDENT } ;

+//     Verb     = ":" LITERAL ;

+//

+// The syntax `*` matches a single URL path segment. The syntax `**` matches

+// zero or more URL path segments, which must be the last part of the URL path

+// except the `Verb`.

+//

+// The syntax `Variable` matches part of the URL path as specified by its

+// template. A variable template must not contain other variables. If a variable

+// matches a single path segment, its template may be omitted, e.g. `{var}`

+// is equivalent to `{var=*}`.

+//

+// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`

+// contains any reserved character, such characters should be percent-encoded

+// before the matching.

+//

+// If a variable contains exactly one path segment, such as `"{var}"` or

+// `"{var=*}"`, when such a variable is expanded into a URL path on the client

+// side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The

+// server side does the reverse decoding. Such variables show up in the

+// [Discovery Document](https://developers.google.com/discovery/v1/reference/apis)

+// as `{var}`.

+//

+// If a variable contains multiple path segments, such as `"{var=foo/*}"`

+// or `"{var=**}"`, when such a variable is expanded into a URL path on the

+// client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.

+// The server side does the reverse decoding, except "%2F" and "%2f" are left

+// unchanged. Such variables show up in the

+// [Discovery Document](https://developers.google.com/discovery/v1/reference/apis)

+// as `{+var}`.

+//

+// ## Using gRPC API Service Configuration

+//

+// gRPC API Service Configuration (service config) is a configuration language

+// for configuring a gRPC service to become a user-facing product. The

+// service config is simply the YAML representation of the `google.api.Service`

+// proto message.

+//

+// As an alternative to annotating your proto file, you can configure gRPC

+// transcoding in your service config YAML files. You do this by specifying a

+// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same

+// effect as the proto annotation. This can be particularly useful if you

+// have a proto that is reused in multiple services. Note that any transcoding

+// specified in the service config will override any matching transcoding

+// configuration in the proto.

+//

+// Example:

+//

+//     http:

+//       rules:

+//         # Selects a gRPC method and applies HttpRule to it.

+//         - selector: example.v1.Messaging.GetMessage

+//           get: /v1/messages/{message_id}/{sub.subfield}

+//

+// ## Special notes

+//

+// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the

+// proto to JSON conversion must follow the [proto3

+// specification](https://developers.google.com/protocol-buffers/docs/proto3#json).

+//

+// While the single segment variable follows the semantics of

+// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String

+// Expansion, the multi segment variable **does not** follow RFC 6570 Section

+// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion

+// does not expand special characters like `?` and `#`, which would lead

+// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding

+// for multi segment variables.

+//

+// The path variables **must not** refer to any repeated or mapped field,

+// because client libraries are not capable of handling such variable expansion.

+//

+// The path variables **must not** capture the leading "/" character. The reason

+// is that the most common use case "{var}" does not capture the leading "/"

+// character. For consistency, all path variables must share the same behavior.

+//

+// Repeated message fields must not be mapped to URL query parameters, because

+// no client library can support such complicated mapping.

+//

+// If an API needs to use a JSON array for request or response body, it can map

+// the request or response body to a repeated field. However, some gRPC

+// Transcoding implementations may not support this feature.

+message HttpRule {

+  // Selects a method to which this rule applies.

+  //

+  // Refer to [selector][google.api.DocumentationRule.selector] for syntax details.

+  string selector = 1;

+

+  // Determines the URL pattern is matched by this rules. This pattern can be

+  // used with any of the {get|put|post|delete|patch} methods. A custom method

+  // can be defined using the 'custom' field.

+  oneof pattern {

+    // Maps to HTTP GET. Used for listing and getting information about

+    // resources.

+    string get = 2;

+

+    // Maps to HTTP PUT. Used for replacing a resource.

+    string put = 3;

+

+    // Maps to HTTP POST. Used for creating a resource or performing an action.

+    string post = 4;

+

+    // Maps to HTTP DELETE. Used for deleting a resource.

+    string delete = 5;

+

+    // Maps to HTTP PATCH. Used for updating a resource.

+    string patch = 6;

+

+    // The custom pattern is used for specifying an HTTP method that is not

+    // included in the `pattern` field, such as HEAD, or "*" to leave the

+    // HTTP method unspecified for this rule. The wild-card rule is useful

+    // for services that provide content to Web (HTML) clients.

+    CustomHttpPattern custom = 8;

+  }

+

+  // The name of the request field whose value is mapped to the HTTP request

+  // body, or `*` for mapping all request fields not captured by the path

+  // pattern to the HTTP body, or omitted for not having any HTTP request body.

+  //

+  // NOTE: the referred field must be present at the top-level of the request

+  // message type.

+  string body = 7;

+

+  // Optional. The name of the response field whose value is mapped to the HTTP

+  // response body. When omitted, the entire response message will be used

+  // as the HTTP response body.

+  //

+  // NOTE: The referred field must be present at the top-level of the response

+  // message type.

+  string response_body = 12;

+

+  // Additional HTTP bindings for the selector. Nested bindings must

+  // not contain an `additional_bindings` field themselves (that is,

+  // the nesting may only be one level deep).

+  repeated HttpRule additional_bindings = 11;

+}

+

+// A custom pattern is used for defining custom HTTP verb.

+message CustomHttpPattern {

+  // The name of this custom HTTP verb.

+  string kind = 1;

+

+  // The path matched by this custom verb.

+  string path = 2;

+}

diff --git a/osam-core/external/src/main/resources/aai.properties b/osam-core/external/src/main/resources/aai.properties
new file mode 100644
index 0000000..e8abfe0
--- /dev/null
+++ b/osam-core/external/src/main/resources/aai.properties
@@ -0,0 +1,7 @@
+aai.host=192.168.62.68

+aai.port=8443

+aai.protocol=https

+aai.username=AAI

+aai.password=AAI

+aai.base.path=/aai/v12

+aai.pnf.path=/network/pnfs/pnf

diff --git a/osam-core/external/src/main/resources/abstractolt.properties b/osam-core/external/src/main/resources/abstractolt.properties
new file mode 100644
index 0000000..07392d8
--- /dev/null
+++ b/osam-core/external/src/main/resources/abstractolt.properties
@@ -0,0 +1,2 @@
+abstractolt.host=135.25.86.132

+abstractolt.port=7777

diff --git a/osam-core/external/src/test/java/org/onap/osam/external/aai/AaiClientTestIT.java b/osam-core/external/src/test/java/org/onap/osam/external/aai/AaiClientTestIT.java
new file mode 100644
index 0000000..aadcd00
--- /dev/null
+++ b/osam-core/external/src/test/java/org/onap/osam/external/aai/AaiClientTestIT.java
@@ -0,0 +1,73 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.external.aai;

+

+import org.junit.Before;

+import org.junit.Test;

+import org.junit.runner.RunWith;

+import org.onap.osam.external.aai.config.AaiConfig;

+import org.onap.osam.external.aai.model.PNF;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.boot.test.context.SpringBootTest;

+import org.springframework.test.context.ContextConfiguration;

+import org.springframework.test.context.junit4.SpringRunner;

+

+/**

+ * Created by cemturker on 01.10.2018.

+ */

+

+@RunWith(SpringRunner.class)

+@SpringBootTest

+@ContextConfiguration(classes = {AaiConfig.class, AaiClientImpl.class})

+public class AaiClientTestIT {

+

+    @Autowired

+    private AaiClient aaiClient;

+

+    @Before

+    public void preProcess(){

+    }

+

+    @Test

+    public void aaiQueryTest(){

+        try {

+            //PNF pnf = aaiClient.queryPnf("1111");

+        }catch (Exception e) {

+            e.printStackTrace();

+        }

+    }

+

+    @Test

+    public void aaiPutTest(){

+        try {

+            PNF pnf = new PNF();

+            pnf.setPnfId("111");

+            pnf.setPnfName("1111");

+            pnf.setIpaddressV4Oam("192.168.61.24");

+            //pnf = aaiClient.putPnf(pnf);

+        }catch (Exception e) {

+            e.printStackTrace();

+        }

+    }

+

+}

diff --git a/osam-core/main/pom.xml b/osam-core/main/pom.xml
new file mode 100644
index 0000000..fd6ec74
--- /dev/null
+++ b/osam-core/main/pom.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!--/*-

+        * ============LICENSE_START=======================================================

+        * OSAM Core

+        * ================================================================================

+        * Copyright (C) 2018 Netsia

+        * ================================================================================

+        * 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.

+        * ============LICENSE_END=========================================================

+        */-->

+

+<project xmlns="http://maven.apache.org/POM/4.0.0"

+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

+    <parent>

+        <artifactId>osam-core</artifactId>

+        <groupId>org.onap.osam</groupId>

+        <version>0.0.1-SNAPSHOT</version>

+    </parent>

+    <modelVersion>4.0.0</modelVersion>

+    <artifactId>main</artifactId>

+    <dependencies>

+        <dependency>

+            <groupId>org.onap.osam</groupId>

+            <artifactId>web</artifactId>

+            <version>${project.version}</version>

+        </dependency>

+    </dependencies>

+    <build>

+        <finalName>osam-core-${project.version}</finalName>

+        <plugins>

+            <plugin>

+                <groupId>org.springframework.boot</groupId>

+                <artifactId>spring-boot-maven-plugin</artifactId>

+                <configuration>

+                    <skip>false</skip>

+                </configuration>

+            </plugin>

+        </plugins>

+    </build>

+

+</project>
\ No newline at end of file
diff --git a/osam-core/main/src/main/java/org/onap/osam/OsamApplication.java b/osam-core/main/src/main/java/org/onap/osam/OsamApplication.java
new file mode 100644
index 0000000..fc207e4
--- /dev/null
+++ b/osam-core/main/src/main/java/org/onap/osam/OsamApplication.java
@@ -0,0 +1,33 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam;

+

+import org.springframework.boot.SpringApplication;

+import org.springframework.boot.autoconfigure.SpringBootApplication;

+

+@SpringBootApplication

+public class OsamApplication {

+	public static void main(String[] args) {

+		SpringApplication.run(OsamApplication.class, args);

+	}

+}

diff --git a/osam-core/main/src/main/resource/banner.txt b/osam-core/main/src/main/resource/banner.txt
new file mode 100644
index 0000000..1ca3fcc
--- /dev/null
+++ b/osam-core/main/src/main/resource/banner.txt
@@ -0,0 +1,5 @@
+ ,-----.   ,---.     ,---.   ,--.   ,--.    ,-----.  ,-----.  ,------.  ,------.

+'  .-.  ' '   .-'   /  O  \  |   `.'   |   '  .--./ '  .-.  ' |  .--. ' |  .---'

+|  | |  | `.  `-.  |  .-.  | |  |'.'|  |   |  |     |  | |  | |  '--'.' |  `--,

+'  '-'  ' .-'    | |  | |  | |  |   |  |   '  '--'\ '  '-'  ' |  |\  \  |  `---.

+ `-----'  `-----'  `--' `--' `--'   `--'    `-----'  `-----'  `--' '--' `------'

diff --git a/osam-core/main/src/test/java/org/onap/osam/OsamApplicationTests.java b/osam-core/main/src/test/java/org/onap/osam/OsamApplicationTests.java
new file mode 100644
index 0000000..da357de
--- /dev/null
+++ b/osam-core/main/src/test/java/org/onap/osam/OsamApplicationTests.java
@@ -0,0 +1,37 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam;

+

+import org.junit.Test;

+import org.junit.runner.RunWith;

+import org.springframework.boot.test.context.SpringBootTest;

+import org.springframework.test.context.junit4.SpringRunner;

+

+@RunWith(SpringRunner.class)

+@SpringBootTest

+public class OsamApplicationTests {

+    @Test

+    public void contextLoads() {

+    }

+

+}

diff --git a/osam-core/model/pom.xml b/osam-core/model/pom.xml
new file mode 100644
index 0000000..93c706f
--- /dev/null
+++ b/osam-core/model/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!--/*-

+        * ============LICENSE_START=======================================================

+        * OSAM Core

+        * ================================================================================

+        * Copyright (C) 2018 Netsia

+        * ================================================================================

+        * 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.

+        * ============LICENSE_END=========================================================

+        */-->

+

+<project xmlns="http://maven.apache.org/POM/4.0.0"

+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

+    <parent>

+        <artifactId>osam-core</artifactId>

+        <groupId>org.onap.osam</groupId>

+        <version>0.0.1-SNAPSHOT</version>

+    </parent>

+    <modelVersion>4.0.0</modelVersion>

+    <artifactId>model</artifactId>

+

+    <dependencies>

+        <dependency>

+            <groupId>org.springframework.boot</groupId>

+            <artifactId>spring-boot-starter-data-jpa</artifactId>

+        </dependency>

+        <dependency>

+            <groupId>org.mariadb.jdbc</groupId>

+            <artifactId>mariadb-java-client</artifactId>

+        </dependency>

+    </dependencies>

+

+</project>
\ No newline at end of file
diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/AccessPod.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/AccessPod.java
new file mode 100644
index 0000000..879e937
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/AccessPod.java
@@ -0,0 +1,66 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.Getter;

+import lombok.Setter;

+

+import javax.persistence.Column;

+import javax.persistence.Entity;

+

+/**

+ * Created by cemturker on 26.09.2018.

+ */

+@Entity

+@Getter

+@Setter

+public class AccessPod extends BaseEntity {

+

+    @Column(unique = true)

+    private String pnfId;

+    @Column(nullable = false)

+    private String coreIp;

+    @Column(nullable = false)

+    private String corePort;

+    @Column(nullable = false)

+    private String ip;

+    @Column(nullable = false)

+    private String port;

+    private String username;

+    private String password;

+

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("AccessPod{");

+        sb.append("pnfId='").append(pnfId).append('\'');

+        sb.append(", coreIp='").append(coreIp).append('\'');

+        sb.append(", corePort='").append(corePort).append('\'');

+        sb.append(", id=").append(id);

+        sb.append(", ip='").append(ip).append('\'');

+        sb.append(", port='").append(port).append('\'');

+        sb.append(", username='").append(username).append('\'');

+        sb.append(", password='").append(password).append('\'');

+        sb.append('}');

+        return sb.toString();

+    }

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/ActiveAlarmsAndEvents.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/ActiveAlarmsAndEvents.java
new file mode 100644
index 0000000..d875d08
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/ActiveAlarmsAndEvents.java
@@ -0,0 +1,43 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+

+import lombok.Data;

+import lombok.NoArgsConstructor;

+

+import javax.persistence.Entity;

+import javax.persistence.Table;

+

+@Table(name = "active_alarm_and_events")

+@Entity

+@NoArgsConstructor

+public class ActiveAlarmsAndEvents extends AlarmsAndEvents {

+

+    public ActiveAlarmsAndEvents(AlarmsAndEvents alarmsAndEvents){

+        super.setAlarmName(alarmsAndEvents.getAlarmName());

+        super.setDate(alarmsAndEvents.getDate());

+        super.setId(alarmsAndEvents.getId());

+        super.setAlarmStatus(alarmsAndEvents.getAlarmStatus());

+    }

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/ActivityState.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/ActivityState.java
new file mode 100644
index 0000000..436f5ac
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/ActivityState.java
@@ -0,0 +1,30 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+public enum ActivityState {

+    ACTIVE, INACTIVE

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/AdminState.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/AdminState.java
new file mode 100644
index 0000000..bf92071
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/AdminState.java
@@ -0,0 +1,30 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+public enum AdminState {

+    ENABLED, DISABLED,PREPROVISION

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/AlarmStatus.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/AlarmStatus.java
new file mode 100644
index 0000000..1c6f9b0
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/AlarmStatus.java
@@ -0,0 +1,34 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.AllArgsConstructor;

+import lombok.NoArgsConstructor;

+

+@AllArgsConstructor

+@NoArgsConstructor

+public enum AlarmStatus {

+    ACTIVE("active"),

+    DEACTIVE("deactive");

+    String type;

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/AlarmsAndEvents.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/AlarmsAndEvents.java
new file mode 100644
index 0000000..76e0f32
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/AlarmsAndEvents.java
@@ -0,0 +1,51 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.AllArgsConstructor;

+import lombok.Data;

+import lombok.EqualsAndHashCode;

+import lombok.NoArgsConstructor;

+

+import javax.persistence.EnumType;

+import javax.persistence.Enumerated;

+import javax.persistence.MappedSuperclass;

+import javax.persistence.Temporal;

+import javax.persistence.TemporalType;

+import java.util.Date;

+

+@Data

+@AllArgsConstructor

+@NoArgsConstructor

+@EqualsAndHashCode(callSuper = false)

+@MappedSuperclass

+public class AlarmsAndEvents extends BaseEntity {

+

+    @Enumerated(value = EnumType.STRING)

+    AlarmStatus alarmStatus;

+

+    String alarmName;

+

+    @Temporal(TemporalType.TIME)

+    Date date;

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/BaseEntity.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/BaseEntity.java
new file mode 100644
index 0000000..67e7fe3
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/BaseEntity.java
@@ -0,0 +1,69 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.AllArgsConstructor;

+import lombok.Data;

+import lombok.NoArgsConstructor;

+

+import javax.persistence.GeneratedValue;

+import javax.persistence.GenerationType;

+import javax.persistence.Id;

+import javax.persistence.MappedSuperclass;

+import java.io.Serializable;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+@MappedSuperclass

+@Data

+@NoArgsConstructor

+@AllArgsConstructor

+public class BaseEntity implements Serializable {

+    @Id

+    @GeneratedValue(strategy = GenerationType.IDENTITY)

+    protected Long id;

+

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("BaseEntity{");

+        sb.append("id=").append(id);

+        sb.append('}');

+        return sb.toString();

+    }

+

+    @Override

+    public boolean equals(Object o) {

+        if (this == o) return true;

+        if (o == null || getClass() != o.getClass()) return false;

+

+        BaseEntity that = (BaseEntity) o;

+

+        return id.equals(that.id);

+    }

+

+    @Override

+    public int hashCode() {

+        return id.hashCode();

+    }

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/Chassis.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/Chassis.java
new file mode 100644
index 0000000..0a17b3a
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/Chassis.java
@@ -0,0 +1,61 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.Getter;

+import lombok.Setter;

+

+import javax.persistence.*;

+import java.util.Set;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+@Entity

+@Getter

+@Setter

+public class Chassis extends BaseEntity {

+

+    @Column(unique = true)

+    private String clli;

+    private int rack;

+    private int shelf;

+    @Enumerated(value = EnumType.STRING)

+    private ActivityState state;

+    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "chassis")

+    private Set<OLTSlot> oltSlots;

+    @ManyToOne

+    @JoinColumn(name="accessPod_pnfId", nullable=false)

+    private AccessPod accessPod;

+

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("Chassis{");

+        sb.append("clli=").append(clli);

+        sb.append(", state='").append(state).append('\'');

+        sb.append(", rack='").append(rack).append('\'');

+        sb.append(", shelf='").append(shelf).append('\'');

+        sb.append('}');

+        return sb.toString();

+    }

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/HistoricalAlarmsAndEvents.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/HistoricalAlarmsAndEvents.java
new file mode 100644
index 0000000..c3b7b2d
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/HistoricalAlarmsAndEvents.java
@@ -0,0 +1,38 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+

+import javax.persistence.Entity;

+import javax.persistence.Table;

+

+@Table(name = "historical_alarms_and_events")

+@Entity

+public class HistoricalAlarmsAndEvents extends AlarmsAndEvents {

+    public HistoricalAlarmsAndEvents(AlarmsAndEvents alarmsAndEvents){

+        super.setAlarmName(alarmsAndEvents.getAlarmName());

+        super.setDate(alarmsAndEvents.getDate());

+        super.setId(alarmsAndEvents.getId());

+        super.setAlarmStatus(alarmsAndEvents.getAlarmStatus());

+    }

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/OLTPort.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/OLTPort.java
new file mode 100644
index 0000000..4783c9d
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/OLTPort.java
@@ -0,0 +1,60 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.Getter;

+import lombok.Setter;

+

+import javax.persistence.*;

+import java.util.Set;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+@Entity

+@Getter

+@Setter

+public class OLTPort extends BaseEntity {

+

+    @Enumerated(value = EnumType.STRING)

+    private ActivityState portAuthState;

+    @Enumerated(value = EnumType.STRING)

+    private AdminState adminState;

+    private Integer portNumber;

+    @ManyToOne

+    @JoinColumn(name="OLTSlot_id", nullable=false)

+    private OLTSlot oltSlot;

+    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "OLTPort")

+    private Set<ONTDevice> ontDevices;

+

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("oltSlot{");

+        sb.append("id=").append(id);

+        sb.append(", portAuthState='").append(portAuthState).append('\'');

+        sb.append(", adminState='").append(adminState).append('\'');

+        sb.append(", portNumber=").append(portNumber);

+        sb.append('}');

+        return sb.toString();

+    }

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/OLTSlot.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/OLTSlot.java
new file mode 100644
index 0000000..9d39503
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/OLTSlot.java
@@ -0,0 +1,80 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.Getter;

+import lombok.Setter;

+

+import javax.persistence.*;

+import java.util.Set;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+@Entity

+@Getter

+@Setter

+public class OLTSlot extends BaseEntity {

+

+    private String serialNumber;

+    @Enumerated(value = EnumType.STRING)

+    private ActivityState operationalState;

+    @Enumerated(value = EnumType.STRING)

+    private ActivityState portAuthState;

+    @Enumerated(value = EnumType.STRING)

+    private AdminState adminState;

+    private String ipAddress;

+    private String hostname;

+    private String macAddress;

+    private Integer port;

+    private Integer number;

+    @Enumerated(value = EnumType.STRING)

+    private OltDriver oltDriver;

+    @Enumerated(value = EnumType.STRING)

+    private OltType oltType;

+    private String name;

+    @ManyToOne

+    @JoinColumn(name="chassis_id", nullable=false)

+    private Chassis chassis;

+    @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "oltSlot")

+    private Set<OLTPort> oltPorts;

+

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("oltSlot{");

+        sb.append("serialNumber=").append(serialNumber);

+        sb.append(", operationalState='").append(operationalState).append('\'');

+        sb.append(", portAuthState='").append(portAuthState).append('\'');

+        sb.append(", adminState='").append(adminState).append('\'');

+        sb.append(", ipAddress=").append(ipAddress);

+        sb.append(", hostname=").append(hostname);

+        sb.append(", macAddress=").append(macAddress);

+        sb.append(", port=").append(port);

+        sb.append(", number=").append(number);

+        sb.append(", name=").append(name);

+        sb.append(", oltDriver=").append(oltDriver);

+        sb.append(", oltType=").append(oltType);

+        sb.append('}');

+        return sb.toString();

+    }

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/ONTDevice.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/ONTDevice.java
new file mode 100644
index 0000000..17666a6
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/ONTDevice.java
@@ -0,0 +1,66 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.Getter;

+import lombok.Setter;

+

+import javax.persistence.*;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+@Entity

+@Getter

+@Setter

+public class ONTDevice extends BaseEntity {

+

+    private String serialNumber;

+    @Enumerated(value = EnumType.STRING)

+    private ActivityState portAuthState;

+    @Enumerated(value = EnumType.STRING)

+    private AdminState adminState;

+    @Enumerated(value = EnumType.STRING)

+    private ActivityState operationalState;

+    private String ipAddress;

+    private String macAddress;

+    private int number;

+    @ManyToOne

+    @JoinColumn(name="OLTPort_id", nullable=false)

+    private OLTPort OLTPort;

+

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("oltSlot{");

+        sb.append("id=").append(id);

+        sb.append(", serialNumber='").append(serialNumber).append('\'');

+        sb.append(", portAuthState='").append(portAuthState).append('\'');

+        sb.append(", adminState='").append(adminState).append('\'');

+        sb.append(", operationalState='").append(operationalState).append('\'');

+        sb.append(", macAddress='").append(macAddress).append('\'');

+        sb.append(", number='").append(number).append('\'');

+        sb.append(", ipAddress=").append(ipAddress);

+        sb.append('}');

+        return sb.toString();

+    }

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/OltDriver.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/OltDriver.java
new file mode 100644
index 0000000..2418196
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/OltDriver.java
@@ -0,0 +1,34 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+public enum OltDriver {

+    OPENOLT,

+    ASFVOLT16,

+    ADTRAN,

+    TIBITS

+}

+

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/OltType.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/OltType.java
new file mode 100644
index 0000000..02de226
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/OltType.java
@@ -0,0 +1,32 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+public enum OltType {

+    EDGECORE,

+    ADTRAN,

+    TIBIT,

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/PmConfig.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/PmConfig.java
new file mode 100644
index 0000000..8cf9d25
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/PmConfig.java
@@ -0,0 +1,53 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.AllArgsConstructor;

+import lombok.Data;

+import lombok.EqualsAndHashCode;

+import lombok.NoArgsConstructor;

+

+import javax.persistence.*;

+

+@Entity

+@Table(name = "pm_config")

+@Data

+@AllArgsConstructor

+@NoArgsConstructor

+@EqualsAndHashCode(callSuper = false)

+public class PmConfig extends BaseEntity {

+    @Enumerated(value = EnumType.STRING)

+    private PmConfigType type;

+

+    private String name;

+    private Boolean enabled;

+    private Integer sampleFreq;

+

+    @ManyToOne

+    @JoinColumn(name="pm_configs_id")

+    private PmConfigs pmConfigs;

+

+    @ManyToOne

+    @JoinColumn(name="pm_group_config_id")

+    private PmGroupConfig pmGroupConfig;

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/PmConfigType.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/PmConfigType.java
new file mode 100644
index 0000000..ac03d48
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/PmConfigType.java
@@ -0,0 +1,30 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+public enum PmConfigType {

+    COUNTER,

+    GAUGE,

+    STATE,

+    CONTEXT

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/PmConfigs.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/PmConfigs.java
new file mode 100644
index 0000000..fa76f80
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/PmConfigs.java
@@ -0,0 +1,46 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.AllArgsConstructor;

+import lombok.Data;

+import lombok.EqualsAndHashCode;

+import lombok.NoArgsConstructor;

+

+import javax.persistence.*;

+import java.util.List;

+

+@Entity

+@Table(name = "pm_configs")

+@Data

+@AllArgsConstructor

+@NoArgsConstructor

+@EqualsAndHashCode(callSuper = false)

+public class PmConfigs extends BaseEntity{

+    private Boolean grouped;

+    @OneToMany(mappedBy = "pmConfigs",cascade = CascadeType.ALL, fetch = FetchType.LAZY)

+    List<PmGroupConfig> pmGroupConfig;

+    @OneToMany(mappedBy = "pmConfigs",cascade = CascadeType.ALL, fetch = FetchType.EAGER)

+    List<PmConfig> pmConfig;

+

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/PmGroupConfig.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/PmGroupConfig.java
new file mode 100644
index 0000000..a233886
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/PmGroupConfig.java
@@ -0,0 +1,50 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.AllArgsConstructor;

+import lombok.Data;

+import lombok.EqualsAndHashCode;

+import lombok.NoArgsConstructor;

+

+import javax.persistence.*;

+import java.util.List;

+

+@Entity

+@Table(name = "pm_group_config")

+@Data

+@AllArgsConstructor

+@NoArgsConstructor

+@EqualsAndHashCode(callSuper = false)

+public class PmGroupConfig extends BaseEntity {

+    private String groupName;

+    private Integer groupFreq;

+    private Boolean enabled;

+    @OneToMany(mappedBy = "pmGroupConfig",cascade = CascadeType.ALL, fetch = FetchType.EAGER)

+    private List<PmConfig> pmConfigList;

+

+    @ManyToOne

+    @JoinColumn(name="pm_configs_id")

+    private PmConfigs pmConfigs;

+

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/Service.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/Service.java
new file mode 100644
index 0000000..a8c5ea5
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/Service.java
@@ -0,0 +1,65 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.Getter;

+import lombok.Setter;

+

+import javax.persistence.Entity;

+import javax.persistence.FetchType;

+import javax.persistence.ManyToMany;

+import javax.persistence.OneToOne;

+import java.util.Set;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+@Entity

+@Getter

+@Setter

+public class Service extends BaseEntity {

+

+    private String name;

+    @OneToOne(fetch = FetchType.EAGER)

+    private TechnologyProfile technologyProfile;

+    @OneToOne(fetch = FetchType.EAGER)

+    private SpeedProfile upStreamProfile;

+    @OneToOne(fetch = FetchType.EAGER)

+    private SpeedProfile downStreamProfile;

+

+    @ManyToMany(mappedBy = "services")

+    private Set<Subscriber> subscribers;

+

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("Service{");

+        sb.append("name='").append(name).append('\'');

+        sb.append(", technologyProfile=").append(technologyProfile);

+        sb.append(", id=").append(id);

+        sb.append(", upStreamProfile=").append(upStreamProfile);

+        sb.append(", downStreamProfile=").append(downStreamProfile);

+        sb.append(", subscribers=").append(subscribers);

+        sb.append('}');

+        return sb.toString();

+    }

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/SpeedProfile.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/SpeedProfile.java
new file mode 100644
index 0000000..d4bf1c1
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/SpeedProfile.java
@@ -0,0 +1,54 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.Getter;

+import lombok.Setter;

+

+import javax.persistence.Entity;

+import javax.persistence.EnumType;

+import javax.persistence.Enumerated;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+@Entity

+@Getter

+@Setter

+public class SpeedProfile extends BaseEntity {

+

+    @Enumerated(value = EnumType.STRING)

+    private StreamDirection streamDirection;

+

+    private String data;

+

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("SpeedProfile{");

+        sb.append("streamDirection=").append(streamDirection);

+        sb.append(", data='").append(data).append('\'');

+        sb.append(", id=").append(id);

+        sb.append('}');

+        return sb.toString();

+    }

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/StreamDirection.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/StreamDirection.java
new file mode 100644
index 0000000..d84c518
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/StreamDirection.java
@@ -0,0 +1,30 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+public enum  StreamDirection {

+    UPSTREAM, DOWNSTREAM

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/Subscriber.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/Subscriber.java
new file mode 100644
index 0000000..6da876d
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/Subscriber.java
@@ -0,0 +1,59 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.Getter;

+import lombok.Setter;

+

+import javax.persistence.*;

+import java.util.Set;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+@Entity

+@Setter

+@Getter

+public class Subscriber extends BaseEntity {

+

+    @Column(unique = true)

+    private String userIdentifier;

+    private Integer cTag;

+    private Integer sTag;

+    @ManyToMany

+    @JoinTable(name = "subscriber_service", joinColumns = @JoinColumn(name = "subscriber_id"),

+    inverseJoinColumns = @JoinColumn(name = "service_id"))

+    private Set<Service> services;

+

+    //TODO Configurations such as NAS and DHCP!

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("Subscriber{");

+        sb.append("userIdentifier='").append(userIdentifier).append('\'');

+        sb.append(", cTag=").append(cTag);

+        sb.append(", sTag=").append(sTag);

+        sb.append(", services=").append(services);

+        sb.append('}');

+        return sb.toString();

+    }

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/dao/TechnologyProfile.java b/osam-core/model/src/main/java/org/onap/osam/model/dao/TechnologyProfile.java
new file mode 100644
index 0000000..f352bd4
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/dao/TechnologyProfile.java
@@ -0,0 +1,48 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.dao;

+

+import lombok.Getter;

+import lombok.Setter;

+

+import javax.persistence.Entity;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+@Entity

+@Getter

+@Setter

+public class TechnologyProfile extends BaseEntity {

+

+    private String data;

+

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("TechnologyProfile{");

+        sb.append("data='").append(data).append('\'');

+        sb.append(", id=").append(id);

+        sb.append('}');

+        return sb.toString();

+    }

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/AccessPodRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/AccessPodRepository.java
new file mode 100644
index 0000000..c4a400c
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/AccessPodRepository.java
@@ -0,0 +1,36 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.AccessPod;

+import org.springframework.data.repository.CrudRepository;

+

+import java.util.Optional;

+

+/**

+ * Created by cemturker on 26.09.2018.

+ */

+public interface AccessPodRepository extends CrudRepository<AccessPod, Long> {

+    Optional<AccessPod> findByPnfId(String pnfId);

+    void removeByPnfId(String pnfId);

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/ActiveAlarmsAndEventsRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/ActiveAlarmsAndEventsRepository.java
new file mode 100644
index 0000000..f474c5b
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/ActiveAlarmsAndEventsRepository.java
@@ -0,0 +1,34 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.ActiveAlarmsAndEvents;

+import org.springframework.data.repository.CrudRepository;

+

+import java.util.Date;

+import java.util.List;

+

+public interface ActiveAlarmsAndEventsRepository extends CrudRepository<ActiveAlarmsAndEvents, Long> {

+    List<ActiveAlarmsAndEvents> findAllActiveAlarmsAndEventsByDateLessThanEqualAndDateGreaterThanEqual(Date endDate, Date startDate);

+

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/ChassisRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/ChassisRepository.java
new file mode 100644
index 0000000..73f1d5f
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/ChassisRepository.java
@@ -0,0 +1,40 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.Chassis;

+import org.springframework.data.jpa.repository.Query;

+import org.springframework.data.repository.CrudRepository;

+

+import java.util.List;

+import java.util.Optional;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+public interface ChassisRepository extends CrudRepository<Chassis, Long> {

+

+    @Query("select c from Chassis c where c.clli = ?1")

+    Optional<Chassis> findByClli(String clli);

+    Optional<List<Chassis>> findByAccessPodPnfId(String pnfId);

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/HistoricalAlarmsAndEventsRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/HistoricalAlarmsAndEventsRepository.java
new file mode 100644
index 0000000..8b1db77
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/HistoricalAlarmsAndEventsRepository.java
@@ -0,0 +1,33 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.HistoricalAlarmsAndEvents;

+import org.springframework.data.repository.CrudRepository;

+

+import java.util.Date;

+import java.util.List;

+

+public interface HistoricalAlarmsAndEventsRepository extends CrudRepository<HistoricalAlarmsAndEvents, Long> {

+    List<HistoricalAlarmsAndEvents> findAllHistoricalAlarmsAndEventsByDateLessThanEqualAndDateGreaterThanEqual(Date endDate, Date startDate);

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/OLTPortRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/OLTPortRepository.java
new file mode 100644
index 0000000..06b7694
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/OLTPortRepository.java
@@ -0,0 +1,39 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.OLTPort;

+import org.springframework.data.jpa.repository.JpaRepository;

+

+import java.util.Optional;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+public interface OLTPortRepository extends JpaRepository<OLTPort, Long> {

+

+    Optional<OLTPort> findByPortNumber(int number);

+

+    Optional<OLTPort> findByPortNumberAndOltSlot_NumberAndOltSlot_ChassisClli(int portNumber, int slotNumber, String clli);

+

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/OLTSlotRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/OLTSlotRepository.java
new file mode 100644
index 0000000..d8fcddf
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/OLTSlotRepository.java
@@ -0,0 +1,37 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.OLTSlot;

+import org.springframework.data.repository.CrudRepository;

+

+import java.util.Optional;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+public interface OLTSlotRepository extends CrudRepository<OLTSlot, Long> {

+

+    Optional<OLTSlot> findByNumber(int number);

+    Optional<OLTSlot> findBySerialNumber(String serialNumber);

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/ONTDeviceRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/ONTDeviceRepository.java
new file mode 100644
index 0000000..9aac009
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/ONTDeviceRepository.java
@@ -0,0 +1,37 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.ONTDevice;

+import org.springframework.data.repository.CrudRepository;

+

+import java.util.Optional;

+

+/**

+ * Created by Zafer Kaban on 18.09.2018.

+ */

+public interface ONTDeviceRepository extends CrudRepository<ONTDevice, Long> {

+

+    Optional<ONTDevice> findBySerialNumber(String serialNumber);

+

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/PmConfigRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/PmConfigRepository.java
new file mode 100644
index 0000000..9964268
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/PmConfigRepository.java
@@ -0,0 +1,35 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.PmConfig;

+import org.springframework.data.repository.CrudRepository;

+

+import java.util.List;

+

+public interface PmConfigRepository extends CrudRepository<PmConfig, Long> {

+

+    List<PmConfig> getByPmConfigs_Id(Long pmConfigsId);

+

+    List<PmConfig> getByPmGroupConfig_Id(Long pmGroupConfigId);

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/PmConfigsRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/PmConfigsRepository.java
new file mode 100644
index 0000000..249f0c5
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/PmConfigsRepository.java
@@ -0,0 +1,29 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.PmConfigs;

+import org.springframework.data.repository.CrudRepository;

+

+public interface PmConfigsRepository extends CrudRepository<PmConfigs, Long> {

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/PmGroupConfigRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/PmGroupConfigRepository.java
new file mode 100644
index 0000000..4867afe
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/PmGroupConfigRepository.java
@@ -0,0 +1,29 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.PmGroupConfig;

+import org.springframework.data.repository.CrudRepository;

+

+public interface PmGroupConfigRepository extends CrudRepository<PmGroupConfig, Long> {

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/ServiceRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/ServiceRepository.java
new file mode 100644
index 0000000..fbec2a3
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/ServiceRepository.java
@@ -0,0 +1,32 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.Service;

+import org.springframework.data.repository.CrudRepository;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+public interface ServiceRepository extends CrudRepository<Service, Long> {

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/SpeedProfileRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/SpeedProfileRepository.java
new file mode 100644
index 0000000..ee4fb0e
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/SpeedProfileRepository.java
@@ -0,0 +1,32 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.SpeedProfile;

+import org.springframework.data.repository.CrudRepository;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+public interface SpeedProfileRepository extends CrudRepository<SpeedProfile, Long> {

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/SubscriberRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/SubscriberRepository.java
new file mode 100644
index 0000000..51da514
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/SubscriberRepository.java
@@ -0,0 +1,34 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.Subscriber;

+import org.springframework.data.repository.CrudRepository;

+

+/**

+ * Created by cemturker on 19.09.2018.

+ */

+public interface SubscriberRepository extends CrudRepository<Subscriber, Long> {

+    Subscriber findByUserIdentifier(String userIdentifier);

+    void deleteByUserIdentifier(String userIdentifier);

+}

diff --git a/osam-core/model/src/main/java/org/onap/osam/model/repository/TechnologyProfileRepository.java b/osam-core/model/src/main/java/org/onap/osam/model/repository/TechnologyProfileRepository.java
new file mode 100644
index 0000000..302cd52
--- /dev/null
+++ b/osam-core/model/src/main/java/org/onap/osam/model/repository/TechnologyProfileRepository.java
@@ -0,0 +1,32 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.model.repository;

+

+import org.onap.osam.model.dao.TechnologyProfile;

+import org.springframework.data.repository.CrudRepository;

+

+/**

+ * Created by cemturker on 18.09.2018.

+ */

+public interface TechnologyProfileRepository extends CrudRepository<TechnologyProfile, Long> {

+}

diff --git a/osam-core/model/src/main/resources/application.properties b/osam-core/model/src/main/resources/application.properties
new file mode 100644
index 0000000..f03a78a
--- /dev/null
+++ b/osam-core/model/src/main/resources/application.properties
@@ -0,0 +1,9 @@
+spring.datasource.url=jdbc:mariadb://localhost:3306/osam_core

+spring.datasource.username=root

+spring.datasource.password=123456

+spring.datasource.driver-class-name=org.mariadb.jdbc.Driver

+spring.jpa.hibernate.ddl-auto=update

+

+logging.level.org.hibernate.SQL=DEBUG

+logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE

+logging.level.org.hibernate.type=TRACE
\ No newline at end of file
diff --git a/osam-core/mvnw b/osam-core/mvnw
new file mode 100644
index 0000000..7778d42
--- /dev/null
+++ b/osam-core/mvnw
@@ -0,0 +1,225 @@
+#!/bin/sh

+# ----------------------------------------------------------------------------

+# Licensed to the Apache Software Foundation (ASF) under one

+# or more contributor license agreements.  See the NOTICE file

+# distributed with this work for additional information

+# regarding copyright ownership.  The ASF licenses this file

+# to you 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.

+# ----------------------------------------------------------------------------

+

+# ----------------------------------------------------------------------------

+# Maven2 Start Up Batch script

+#

+# Required ENV vars:

+# ------------------

+#   JAVA_HOME - location of a JDK home dir

+#

+# Optional ENV vars

+# -----------------

+#   M2_HOME - location of maven2's installed home dir

+#   MAVEN_OPTS - parameters passed to the Java VM when running Maven

+#     e.g. to debug Maven itself, use

+#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000

+#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files

+# ----------------------------------------------------------------------------

+

+if [ -z "$MAVEN_SKIP_RC" ] ; then

+

+  if [ -f /etc/mavenrc ] ; then

+    . /etc/mavenrc

+  fi

+

+  if [ -f "$HOME/.mavenrc" ] ; then

+    . "$HOME/.mavenrc"

+  fi

+

+fi

+

+# OS specific support.  $var _must_ be set to either true or false.

+cygwin=false;

+darwin=false;

+mingw=false

+case "`uname`" in

+  CYGWIN*) cygwin=true ;;

+  MINGW*) mingw=true;;

+  Darwin*) darwin=true

+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home

+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html

+    if [ -z "$JAVA_HOME" ]; then

+      if [ -x "/usr/libexec/java_home" ]; then

+        export JAVA_HOME="`/usr/libexec/java_home`"

+      else

+        export JAVA_HOME="/Library/Java/Home"

+      fi

+    fi

+    ;;

+esac

+

+if [ -z "$JAVA_HOME" ] ; then

+  if [ -r /etc/gentoo-release ] ; then

+    JAVA_HOME=`java-config --jre-home`

+  fi

+fi

+

+if [ -z "$M2_HOME" ] ; then

+  ## resolve links - $0 may be a link to maven's home

+  PRG="$0"

+

+  # need this for relative symlinks

+  while [ -h "$PRG" ] ; do

+    ls=`ls -ld "$PRG"`

+    link=`expr "$ls" : '.*-> \(.*\)$'`

+    if expr "$link" : '/.*' > /dev/null; then

+      PRG="$link"

+    else

+      PRG="`dirname "$PRG"`/$link"

+    fi

+  done

+

+  saveddir=`pwd`

+

+  M2_HOME=`dirname "$PRG"`/..

+

+  # make it fully qualified

+  M2_HOME=`cd "$M2_HOME" && pwd`

+

+  cd "$saveddir"

+  # echo Using m2 at $M2_HOME

+fi

+

+# For Cygwin, ensure paths are in UNIX format before anything is touched

+if $cygwin ; then

+  [ -n "$M2_HOME" ] &&

+    M2_HOME=`cygpath --unix "$M2_HOME"`

+  [ -n "$JAVA_HOME" ] &&

+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`

+  [ -n "$CLASSPATH" ] &&

+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`

+fi

+

+# For Migwn, ensure paths are in UNIX format before anything is touched

+if $mingw ; then

+  [ -n "$M2_HOME" ] &&

+    M2_HOME="`(cd "$M2_HOME"; pwd)`"

+  [ -n "$JAVA_HOME" ] &&

+    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"

+  # TODO classpath?

+fi

+

+if [ -z "$JAVA_HOME" ]; then

+  javaExecutable="`which javac`"

+  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then

+    # readlink(1) is not available as standard on Solaris 10.

+    readLink=`which readlink`

+    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then

+      if $darwin ; then

+        javaHome="`dirname \"$javaExecutable\"`"

+        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"

+      else

+        javaExecutable="`readlink -f \"$javaExecutable\"`"

+      fi

+      javaHome="`dirname \"$javaExecutable\"`"

+      javaHome=`expr "$javaHome" : '\(.*\)/bin'`

+      JAVA_HOME="$javaHome"

+      export JAVA_HOME

+    fi

+  fi

+fi

+

+if [ -z "$JAVACMD" ] ; then

+  if [ -n "$JAVA_HOME"  ] ; then

+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then

+      # IBM's JDK on AIX uses strange locations for the executables

+      JAVACMD="$JAVA_HOME/jre/sh/java"

+    else

+      JAVACMD="$JAVA_HOME/bin/java"

+    fi

+  else

+    JAVACMD="`which java`"

+  fi

+fi

+

+if [ ! -x "$JAVACMD" ] ; then

+  echo "Error: JAVA_HOME is not defined correctly." >&2

+  echo "  We cannot execute $JAVACMD" >&2

+  exit 1

+fi

+

+if [ -z "$JAVA_HOME" ] ; then

+  echo "Warning: JAVA_HOME environment variable is not set."

+fi

+

+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher

+

+# traverses directory structure from process work directory to filesystem root

+# first directory with .mvn subdirectory is considered project base directory

+find_maven_basedir() {

+

+  if [ -z "$1" ]

+  then

+    echo "Path not specified to find_maven_basedir"

+    return 1

+  fi

+

+  basedir="$1"

+  wdir="$1"

+  while [ "$wdir" != '/' ] ; do

+    if [ -d "$wdir"/.mvn ] ; then

+      basedir=$wdir

+      break

+    fi

+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)

+    if [ -d "${wdir}" ]; then

+      wdir=`cd "$wdir/.."; pwd`

+    fi

+    # end of workaround

+  done

+  echo "${basedir}"

+}

+

+# concatenates all lines of a file

+concat_lines() {

+  if [ -f "$1" ]; then

+    echo "$(tr -s '\n' ' ' < "$1")"

+  fi

+}

+

+BASE_DIR=`find_maven_basedir "$(pwd)"`

+if [ -z "$BASE_DIR" ]; then

+  exit 1;

+fi

+

+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}

+echo $MAVEN_PROJECTBASEDIR

+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"

+

+# For Cygwin, switch paths to Windows format before running java

+if $cygwin; then

+  [ -n "$M2_HOME" ] &&

+    M2_HOME=`cygpath --path --windows "$M2_HOME"`

+  [ -n "$JAVA_HOME" ] &&

+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`

+  [ -n "$CLASSPATH" ] &&

+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`

+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&

+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`

+fi

+

+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

+

+exec "$JAVACMD" \

+  $MAVEN_OPTS \

+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \

+  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \

+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

diff --git a/osam-core/mvnw.cmd b/osam-core/mvnw.cmd
new file mode 100644
index 0000000..48c810e
--- /dev/null
+++ b/osam-core/mvnw.cmd
@@ -0,0 +1,143 @@
+@REM ----------------------------------------------------------------------------

+@REM Licensed to the Apache Software Foundation (ASF) under one

+@REM or more contributor license agreements.  See the NOTICE file

+@REM distributed with this work for additional information

+@REM regarding copyright ownership.  The ASF licenses this file

+@REM to you under the Apache License, Version 2.0 (the

+@REM "License"); you may not use this file except in compliance

+@REM with the License.  You may obtain a copy of the License at

+@REM

+@REM    http://www.apache.org/licenses/LICENSE-2.0

+@REM

+@REM Unless required by applicable law or agreed to in writing,

+@REM software distributed under the License is distributed on an

+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

+@REM KIND, either express or implied.  See the License for the

+@REM specific language governing permissions and limitations

+@REM under the License.

+@REM ----------------------------------------------------------------------------

+

+@REM ----------------------------------------------------------------------------

+@REM Maven2 Start Up Batch script

+@REM

+@REM Required ENV vars:

+@REM JAVA_HOME - location of a JDK home dir

+@REM

+@REM Optional ENV vars

+@REM M2_HOME - location of maven2's installed home dir

+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands

+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending

+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven

+@REM     e.g. to debug Maven itself, use

+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000

+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files

+@REM ----------------------------------------------------------------------------

+

+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'

+@echo off

+@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'

+@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%

+

+@REM set %HOME% to equivalent of $HOME

+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")

+

+@REM Execute a user defined script before this one

+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre

+@REM check for pre script, once with legacy .bat ending and once with .cmd ending

+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"

+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"

+:skipRcPre

+

+@setlocal

+

+set ERROR_CODE=0

+

+@REM To isolate internal variables from possible post scripts, we use another setlocal

+@setlocal

+

+@REM ==== START VALIDATION ====

+if not "%JAVA_HOME%" == "" goto OkJHome

+

+echo.

+echo Error: JAVA_HOME not found in your environment. >&2

+echo Please set the JAVA_HOME variable in your environment to match the >&2

+echo location of your Java installation. >&2

+echo.

+goto error

+

+:OkJHome

+if exist "%JAVA_HOME%\bin\java.exe" goto init

+

+echo.

+echo Error: JAVA_HOME is set to an invalid directory. >&2

+echo JAVA_HOME = "%JAVA_HOME%" >&2

+echo Please set the JAVA_HOME variable in your environment to match the >&2

+echo location of your Java installation. >&2

+echo.

+goto error

+

+@REM ==== END VALIDATION ====

+

+:init

+

+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".

+@REM Fallback to current working directory if not found.

+

+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%

+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir

+

+set EXEC_DIR=%CD%

+set WDIR=%EXEC_DIR%

+:findBaseDir

+IF EXIST "%WDIR%"\.mvn goto baseDirFound

+cd ..

+IF "%WDIR%"=="%CD%" goto baseDirNotFound

+set WDIR=%CD%

+goto findBaseDir

+

+:baseDirFound

+set MAVEN_PROJECTBASEDIR=%WDIR%

+cd "%EXEC_DIR%"

+goto endDetectBaseDir

+

+:baseDirNotFound

+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%

+cd "%EXEC_DIR%"

+

+:endDetectBaseDir

+

+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig

+

+@setlocal EnableExtensions EnableDelayedExpansion

+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a

+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%

+

+:endReadAdditionalConfig

+

+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"

+

+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"

+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain

+

+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*

+if ERRORLEVEL 1 goto error

+goto end

+

+:error

+set ERROR_CODE=1

+

+:end

+@endlocal & set ERROR_CODE=%ERROR_CODE%

+

+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost

+@REM check for post script, once with legacy .bat ending and once with .cmd ending

+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"

+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"

+:skipRcPost

+

+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'

+if "%MAVEN_BATCH_PAUSE%" == "on" pause

+

+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%

+

+exit /B %ERROR_CODE%

diff --git a/osam-core/pom.xml b/osam-core/pom.xml
new file mode 100644
index 0000000..bd6beef
--- /dev/null
+++ b/osam-core/pom.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

+	<modelVersion>4.0.0</modelVersion>

+

+	<groupId>org.onap.osam</groupId>

+	<artifactId>osam-core</artifactId>

+	<version>0.0.1-SNAPSHOT</version>

+	<parent>

+		<groupId>org.springframework.boot</groupId>

+		<artifactId>spring-boot-starter-parent</artifactId>

+		<version>2.0.6.RELEASE</version>

+		<relativePath/> <!-- lookup parent from repository -->

+	</parent>

+	<modules>

+		<module>common</module>

+		<module>model</module>

+		<module>api</module>

+		<module>external</module>

+		<module>core</module>

+		<module>web</module>

+		<module>main</module>

+	</modules>

+	<packaging>pom</packaging>

+

+	<name>osam</name>

+	<description>OpenSource Access Manager</description>

+

+	<properties>

+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

+		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

+		<java.version>1.8</java.version>

+		<grpc-spring-boot-starter.version>2.3.2</grpc-spring-boot-starter.version>

+		<os-maven-plugin.version>1.6.0</os-maven-plugin.version>

+		<protobuf-maven-plugin.version>0.5.1</protobuf-maven-plugin.version>

+		<guava.version>20.0</guava.version>

+		<msb.sdk.version>1.2.0-SNAPSHOT</msb.sdk.version>

+		<swagger.version>2.8.0</swagger.version>

+	</properties>

+

+	<dependencies>

+		<dependency>

+			<groupId>org.projectlombok</groupId>

+			<artifactId>lombok</artifactId>

+			<optional>true</optional>

+		</dependency>

+		<dependency>

+			<groupId>org.springframework.boot</groupId>

+			<artifactId>spring-boot-starter-test</artifactId>

+			<scope>test</scope>

+		</dependency>

+	</dependencies>

+	<dependencyManagement>

+		<dependencies>

+			<dependency>

+				<groupId>${project.groupId}</groupId>

+				<artifactId>model</artifactId>

+				<version>${project.version}</version>

+			</dependency>

+			<dependency>

+				<groupId>${project.groupId}</groupId>

+				<artifactId>api</artifactId>

+				<version>${project.version}</version>

+			</dependency>

+			<dependency>

+				<groupId>${project.groupId}</groupId>

+				<artifactId>common</artifactId>

+				<version>${project.version}</version>

+			</dependency>

+			<dependency>

+				<groupId>${project.groupId}</groupId>

+				<artifactId>external</artifactId>

+				<version>${project.version}</version>

+			</dependency>

+			<dependency>

+				<groupId>${project.groupId}</groupId>

+				<artifactId>core</artifactId>

+				<version>${project.version}</version>

+			</dependency>

+			<dependency>

+				<groupId>${project.groupId}</groupId>

+				<artifactId>web</artifactId>

+				<version>${project.version}</version>

+			</dependency>

+			<dependency>

+				<groupId>${project.groupId}</groupId>

+				<artifactId>main</artifactId>

+				<version>${project.version}</version>

+			</dependency>

+		</dependencies>

+	</dependencyManagement>

+	<build>

+		<plugins>

+            <!-- License plugin should only run once at the start of the project.

+             For new classes, the header should be added manually by the company which creates it.-->

+            <!--<plugin>

+                <groupId>org.codehaus.mojo</groupId>

+                <artifactId>license-maven-plugin</artifactId>

+                <version>1.16</version>

+                <configuration>

+                    <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>

+                    <processStartTag>============LICENSE_START=======================================================</processStartTag>

+                    <processEndTag>============LICENSE_END=========================================================</processEndTag>

+                    <sectionDelimiter>================================================================================</sectionDelimiter>

+                    <licenseName>apache_v2</licenseName>

+                    <inceptionYear>2018</inceptionYear>

+                    <organizationName>Netsia</organizationName>

+                    <projectName>OSAM Core</projectName>

+                    <canUpdateCopyright>true</canUpdateCopyright>

+                    <canUpdateDescription>true</canUpdateDescription>

+                    <canUpdateLicense>true</canUpdateLicense>

+                    <emptyLineAfterHeader>true</emptyLineAfterHeader>

+                    <verbose>false</verbose>

+                    <includes>

+                        <include>**/*.java</include>

+                    </includes>

+                </configuration>

+                <executions>

+                    <execution>

+                        <id>first</id>

+                        <goals>

+                            <goal>update-file-header</goal>

+                        </goals>

+                        <phase>process-sources</phase>

+                    </execution>

+                </executions>

+            </plugin>-->

+			<plugin>

+				<groupId>org.springframework.boot</groupId>

+				<artifactId>spring-boot-maven-plugin</artifactId>

+				<configuration>

+					<skip>true</skip>

+				</configuration>

+			</plugin>

+		</plugins>

+	</build>

+</project>

diff --git a/osam-core/web/pom.xml b/osam-core/web/pom.xml
new file mode 100644
index 0000000..e8bd078
--- /dev/null
+++ b/osam-core/web/pom.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<!--/*-

+        * ============LICENSE_START=======================================================

+        * OSAM Core

+        * ================================================================================

+        * Copyright (C) 2018 Netsia

+        * ================================================================================

+        * 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.

+        * ============LICENSE_END=========================================================

+        */-->

+

+<project xmlns="http://maven.apache.org/POM/4.0.0"

+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

+    <parent>

+        <artifactId>osam-core</artifactId>

+        <groupId>org.onap.osam</groupId>

+        <version>0.0.1-SNAPSHOT</version>

+    </parent>

+    <modelVersion>4.0.0</modelVersion>

+    <artifactId>web</artifactId>

+    <dependencies>

+        <dependency>

+            <groupId>org.onap.osam</groupId>

+            <artifactId>core</artifactId>

+            <version>${project.version}</version>

+        </dependency>

+        <dependency>

+            <groupId>org.springframework.boot</groupId>

+            <artifactId>spring-boot-starter-web</artifactId>

+        </dependency>

+        <dependency>

+            <groupId>io.springfox</groupId>

+            <artifactId>springfox-swagger-ui</artifactId>

+            <version>${swagger.version}</version>

+            <scope>compile</scope>

+        </dependency>

+        <dependency>

+            <groupId>io.springfox</groupId>

+            <artifactId>springfox-swagger2</artifactId>

+            <version>${swagger.version}</version>

+            <scope>compile</scope>

+        </dependency>

+    </dependencies>

+

+</project>
\ No newline at end of file
diff --git a/osam-core/web/src/main/java/org/onap/osam/controller/AbstractController.java b/osam-core/web/src/main/java/org/onap/osam/controller/AbstractController.java
new file mode 100644
index 0000000..97bfa7c
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/controller/AbstractController.java
@@ -0,0 +1,53 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.controller;

+

+import org.onap.osam.common.exception.BadFormatException;

+import org.onap.osam.common.exception.NotFoundException;

+import org.onap.osam.common.exception.UnknownTypeException;

+import org.slf4j.Logger;

+import org.springframework.http.HttpStatus;

+import org.springframework.http.ResponseEntity;

+

+/**

+ * Created by cemturker on 30.09.2018.

+ */

+public abstract class AbstractController {

+

+    private Logger logger;

+

+    public AbstractController(Logger logger) {

+        this.logger = logger;

+    }

+

+    public <T>  ResponseEntity<T> proceedException(Exception e) {

+        if (e instanceof BadFormatException || e instanceof UnknownTypeException) {

+            return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();

+        } else if(e instanceof NotFoundException) {

+            return ResponseEntity.status(HttpStatus.NOT_FOUND).build();

+        } else {

+            logger.error("",e);

+            return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).build();

+        }

+    }

+}

diff --git a/osam-core/web/src/main/java/org/onap/osam/controller/AccessPodRestController.java b/osam-core/web/src/main/java/org/onap/osam/controller/AccessPodRestController.java
new file mode 100644
index 0000000..b4fbec0
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/controller/AccessPodRestController.java
@@ -0,0 +1,97 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.controller;

+

+import lombok.extern.slf4j.Slf4j;

+import org.onap.osam.dto.AccessPodDTO;

+import org.onap.osam.helper.DTOMapper;

+import org.onap.osam.model.dao.AccessPod;

+import org.onap.osam.api.service.AccessPodService;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.HttpStatus;

+import org.springframework.http.ResponseEntity;

+import org.springframework.web.bind.annotation.DeleteMapping;

+import org.springframework.web.bind.annotation.GetMapping;

+import org.springframework.web.bind.annotation.PathVariable;

+import org.springframework.web.bind.annotation.PostMapping;

+import org.springframework.web.bind.annotation.RequestBody;

+import org.springframework.web.bind.annotation.RequestMapping;

+import org.springframework.web.bind.annotation.RestController;

+

+import java.util.List;

+

+/**

+ * Created by cemturker on 27.09.2018.

+ */

+@RestController

+@RequestMapping("/accessPod")

+@Slf4j

+public class AccessPodRestController extends AbstractController {

+

+    private AccessPodService accessPodService;

+

+    @Autowired

+    public AccessPodRestController(AccessPodService accessPodService) {

+        super(log);

+        this.accessPodService = accessPodService;

+    }

+

+    @GetMapping

+    public List<AccessPodDTO> getAccessPods(){

+        return DTOMapper.covertAccessPodsToDtos(accessPodService.getAll());

+    }

+

+    @PostMapping

+    public ResponseEntity<AccessPodDTO> postAccessPod(@RequestBody AccessPodDTO accessPodDTO){

+        try {

+            log.info("Post request for {} is received",accessPodDTO);

+            AccessPod accessPod = DTOMapper.covertDtoToAccessPod(accessPodDTO);

+            accessPod = accessPodService.addOrUpdate(accessPod);

+            return new ResponseEntity<>(DTOMapper.covertAccessPodToDto(accessPod),HttpStatus.CREATED);

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+    }

+

+    @DeleteMapping("pnf/{pnfId}")

+    public ResponseEntity deleteAccessPodByPnfId(@PathVariable("pnfId") String pnfId) {

+        try{

+            this.accessPodService.removeByPnfId(pnfId);

+            return ResponseEntity.ok().build();

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+

+    }

+

+    @DeleteMapping("/{id}")

+    public ResponseEntity deleteAccessPod(@PathVariable("id") Long id) {

+        try {

+            this.accessPodService.removeById(id);

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+        return ResponseEntity.ok().build();

+    }

+

+}

diff --git a/osam-core/web/src/main/java/org/onap/osam/controller/DeviceController.java b/osam-core/web/src/main/java/org/onap/osam/controller/DeviceController.java
new file mode 100644
index 0000000..026ec17
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/controller/DeviceController.java
@@ -0,0 +1,136 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.controller;

+

+import lombok.extern.slf4j.Slf4j;

+import org.onap.osam.api.service.DeviceService;

+import org.onap.osam.dto.ChassisDTO;

+import org.onap.osam.dto.OLTChassisDTO;

+import org.onap.osam.dto.ONTDTO;

+import org.onap.osam.helper.DTOMapper;

+import org.onap.osam.model.dao.*;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.HttpStatus;

+import org.springframework.http.ResponseEntity;

+import org.springframework.web.bind.annotation.*;

+

+import java.util.List;

+import java.util.Map;

+

+/**

+ * Created by Zafer Kaban on 27.09.2018.

+ */

+@CrossOrigin

+@RestController

+@RequestMapping("/device")

+@Slf4j

+public class DeviceController extends AbstractController {

+

+    private DeviceService deviceService;

+

+    @Autowired

+    public DeviceController(DeviceService deviceService) {

+        super(log);

+        this.deviceService = deviceService;

+    }

+

+    @PostMapping("/chassis")

+    public ResponseEntity<ChassisDTO> postChassis(@RequestBody ChassisDTO chassisDTO){

+        try {

+            log.info("postChassis request is received {}",chassisDTO);

+            Chassis chassis = DTOMapper.convertToChassis(chassisDTO);

+            chassis = deviceService.addChassis(chassis);

+            return new ResponseEntity<>(DTOMapper.convertChassisToDTO(chassis),HttpStatus.CREATED);

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+

+    }

+

+    @DeleteMapping("chassis/{clli}")

+    public ResponseEntity deleteChassisByClli(@PathVariable("clli") String clli) {

+        try{

+            this.deviceService.deleteChassisByClli(clli);

+            return ResponseEntity.ok().build();

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+

+    }

+

+

+    @PostMapping("/chassis/olt")

+    public ResponseEntity<OLTChassisDTO> postOLTChassis(@RequestBody OLTChassisDTO oltChassisDTO){

+        try {

+            Chassis chassis = this.deviceService.getChassisByClli(oltChassisDTO.getClli());

+            OLTSlot oltSlot = DTOMapper.convertToOLT(oltChassisDTO);

+            oltSlot.setChassis(chassis);

+            this.deviceService.addOLTSlot(oltSlot, chassis);

+            return new ResponseEntity<> (DTOMapper.convertFromOLT(oltSlot),HttpStatus.CREATED);

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+

+    }

+

+    @PostMapping("/chassis/olt/ont")

+    public ResponseEntity<ONTDTO> postONTDevice(@RequestBody ONTDTO ontDTO){

+        try {

+            ONTDevice ont = deviceService.addONTDevice(ontDTO.getClli()

+                    ,ontDTO.getSlotNumber()

+                    ,ontDTO.getPortNumber()

+                    ,ontDTO.getSerialNumber());

+            return new ResponseEntity<> (DTOMapper.convertFromONTDevice(ont),HttpStatus.CREATED);

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+

+    }

+

+    @GetMapping("/chassis")

+    public ResponseEntity<List<ChassisDTO>> getAllChassis(){

+        try {

+            return new ResponseEntity<> (DTOMapper.convertChassisToDTO(deviceService.getAllChassis()), HttpStatus.OK);

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+    }

+

+    @GetMapping("/chassis/olt")

+    public ResponseEntity<Map<String, List<OLTChassisDTO>>> getAllOLTDevices(){

+        try {

+            return new ResponseEntity<> (DTOMapper.convertFromOLT(deviceService.getAllOLTSlots()), HttpStatus.OK);

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+    }

+

+    @GetMapping("/chassis/olt/ont")

+    public ResponseEntity<Map<String, List<ONTDTO>>> getAllONTDevices(){

+        try {

+            return new ResponseEntity<> (DTOMapper.convertFromONTDevice(deviceService.getAllONTDevices()), HttpStatus.OK);

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+    }

+}

diff --git a/osam-core/web/src/main/java/org/onap/osam/controller/ServiceController.java b/osam-core/web/src/main/java/org/onap/osam/controller/ServiceController.java
new file mode 100644
index 0000000..d033a1a
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/controller/ServiceController.java
@@ -0,0 +1,135 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.controller;

+

+import lombok.extern.slf4j.Slf4j;

+import org.onap.osam.model.dao.SpeedProfile;

+import org.onap.osam.model.dao.TechnologyProfile;

+import org.onap.osam.api.service.BroadBandService;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.HttpStatus;

+import org.springframework.http.ResponseEntity;

+import org.springframework.web.bind.annotation.DeleteMapping;

+import org.springframework.web.bind.annotation.GetMapping;

+import org.springframework.web.bind.annotation.PathVariable;

+import org.springframework.web.bind.annotation.PostMapping;

+import org.springframework.web.bind.annotation.RequestBody;

+import org.springframework.web.bind.annotation.RequestMapping;

+import org.springframework.web.bind.annotation.RestController;

+

+import java.util.List;

+

+/**

+ * Created by cemturker on 19.09.2018.

+ */

+@RestController

+@RequestMapping("/service")

+@Slf4j

+public class ServiceController extends AbstractController {

+

+    private BroadBandService broadBandService;

+

+    //TODOs add validations for post reqs...

+

+    @Autowired

+    public ServiceController(BroadBandService broadBandService){

+        super(log);

+        this.broadBandService = broadBandService;

+    }

+

+    @GetMapping("/speedProfile")

+    public ResponseEntity<List<SpeedProfile>> getSpeedProfiles() {

+        try{

+            return ResponseEntity.ok(this.broadBandService.getSpeedProfiles());

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+    }

+

+    @GetMapping("/speedProfile/{id}")

+    public ResponseEntity<SpeedProfile> getSpeedProfile(@PathVariable("id") Long id) {

+        try {

+            return ResponseEntity.ok(this.broadBandService.getSpeedProfile(id));

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+    }

+

+    @DeleteMapping("/speedProfile/{id}")

+    public ResponseEntity deleteSpeedProfile(@PathVariable("id") Long id) {

+        try {

+            this.broadBandService.removeSpeedProfile(id);

+            return ResponseEntity.ok().build();

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+    }

+

+    @PostMapping("/speedProfile")

+    public ResponseEntity<SpeedProfile> createSpeedProfile(@RequestBody SpeedProfile speedProfile) {

+        try {

+            return new ResponseEntity<>(this.broadBandService.addSpeedProfile(speedProfile),

+                    HttpStatus.CREATED);

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+

+    }

+

+    @GetMapping("/technologyProfile")

+    public ResponseEntity<List<TechnologyProfile>> getTechnologyProfiles() {

+        try {

+            return ResponseEntity.ok(this.broadBandService.getTechnologyProfiles());

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+    }

+

+    @GetMapping("/technologyProfile/{id}")

+    public ResponseEntity<TechnologyProfile> getTechnologyProfile(@PathVariable("id") Long id) {

+        try {

+            return ResponseEntity.ok(this.broadBandService.getTechnologyProfile(id));

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+    }

+

+    @DeleteMapping("/technologyProfile/{id}")

+    public ResponseEntity deleteTechnologyProfile(@PathVariable("id") Long id) {

+        try {

+            this.broadBandService.removeSpeedProfile(id);

+            return ResponseEntity.ok().build();

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+    }

+

+    @PostMapping("/technologyProfile")

+    public ResponseEntity<TechnologyProfile> createTechnologyProfile(@RequestBody TechnologyProfile technologyProfile) {

+        try {

+            return new ResponseEntity<>(this.broadBandService.addTechnologyProfile(technologyProfile),HttpStatus.CREATED);

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+    }

+}

diff --git a/osam-core/web/src/main/java/org/onap/osam/controller/TopologyController.java b/osam-core/web/src/main/java/org/onap/osam/controller/TopologyController.java
new file mode 100644
index 0000000..6f760ee
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/controller/TopologyController.java
@@ -0,0 +1,70 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.controller;

+

+import lombok.extern.slf4j.Slf4j;

+import org.onap.osam.api.service.AccessPodService;

+import org.onap.osam.api.service.DeviceService;

+import org.onap.osam.dto.AccessPodDTO;

+import org.onap.osam.helper.DTOMapper;

+import org.onap.osam.model.dao.AccessPod;

+import org.onap.osam.model.dao.Chassis;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.ResponseEntity;

+import org.springframework.web.bind.annotation.GetMapping;

+import org.springframework.web.bind.annotation.PathVariable;

+import org.springframework.web.bind.annotation.RequestMapping;

+import org.springframework.web.bind.annotation.RestController;

+

+import java.util.List;

+

+/**

+ * Created by cemturker on 03.10.2018.

+ */

+@RestController

+@RequestMapping("topology")

+@Slf4j

+public class TopologyController extends AbstractController {

+    private AccessPodService accessPodService;

+    private DeviceService deviceService;

+

+    @Autowired

+    public TopologyController(AccessPodService accessPodService,

+                              DeviceService deviceService) {

+        super(log);

+        this.accessPodService = accessPodService;

+        this.deviceService = deviceService;

+    }

+

+    @GetMapping("/accessPod/{pnfId}")

+    public ResponseEntity<AccessPodDTO> getTopologyWithPnfId(@PathVariable("pnfId") String pnfId) {

+        try{

+            log.info("GetTopology with pnfId:{} is received.",pnfId);

+            AccessPod accessPod = accessPodService.findByPnfId(pnfId);

+            List<Chassis> chassisList = deviceService.getByPnfId(pnfId);

+            return ResponseEntity.ok(DTOMapper.representTheAccessPod(chassisList,accessPod));

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+    }

+}

diff --git a/osam-core/web/src/main/java/org/onap/osam/controller/config/SwaggerConfig.java b/osam-core/web/src/main/java/org/onap/osam/controller/config/SwaggerConfig.java
new file mode 100644
index 0000000..20a538c
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/controller/config/SwaggerConfig.java
@@ -0,0 +1,57 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.controller.config;

+

+import org.springframework.context.annotation.Bean;

+import org.springframework.context.annotation.Configuration;

+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;

+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

+import springfox.documentation.builders.PathSelectors;

+import springfox.documentation.builders.RequestHandlerSelectors;

+import springfox.documentation.spi.DocumentationType;

+import springfox.documentation.spring.web.plugins.Docket;

+import springfox.documentation.swagger2.annotations.EnableSwagger2;

+

+/**

+ * Created by cemturker on 04.10.2018.

+ */

+@Configuration

+@EnableSwagger2

+public class SwaggerConfig extends WebMvcConfigurationSupport {

+    @Bean

+    public Docket osamApi() {

+        return new Docket(DocumentationType.SWAGGER_2)

+                .select()                 .apis(RequestHandlerSelectors.any())

+                .paths(PathSelectors.any())

+                .build();

+    }

+

+    @Override

+    protected void addResourceHandlers(ResourceHandlerRegistry registry) {

+        registry.addResourceHandler("swagger-ui.html")

+                .addResourceLocations("classpath:/META-INF/resources/");

+

+        registry.addResourceHandler("/webjars/**")

+                .addResourceLocations("classpath:/META-INF/resources/webjars/");

+    }

+}

diff --git a/osam-core/web/src/main/java/org/onap/osam/dto/AccessPodDTO.java b/osam-core/web/src/main/java/org/onap/osam/dto/AccessPodDTO.java
new file mode 100644
index 0000000..52570c7
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/dto/AccessPodDTO.java
@@ -0,0 +1,69 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.dto;

+

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonRootName;

+import lombok.AllArgsConstructor;

+import lombok.Getter;

+import lombok.NoArgsConstructor;

+import lombok.Setter;

+

+import java.util.List;

+

+/**

+ * Created by cemturker on 01.10.2018.

+ */

+@Getter

+@Setter

+@NoArgsConstructor

+@AllArgsConstructor

+@JsonRootName("AccessPod")

+@JsonInclude(JsonInclude.Include.NON_NULL)

+public class AccessPodDTO {

+    private Long id;

+    private String pnfId;

+    private String ip;

+    private String port;

+    private String coreIp;

+    private String corePort;

+    private String username;

+    private String password;

+    private List<ChassisDTO> chassises;

+

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("AccessPodDTO{");

+        sb.append("id=").append(id);

+        sb.append(", pnfId='").append(pnfId).append('\'');

+        sb.append(", ip='").append(ip).append('\'');

+        sb.append(", port='").append(port).append('\'');

+        sb.append(", coreIp='").append(coreIp).append('\'');

+        sb.append(", corePort='").append(corePort).append('\'');

+        sb.append(", username='").append(username).append('\'');

+        sb.append(", password='").append(password).append('\'');

+        sb.append(", chassises=").append(chassises);

+        sb.append('}');

+        return sb.toString();

+    }

+}

diff --git a/osam-core/web/src/main/java/org/onap/osam/dto/ChassisDTO.java b/osam-core/web/src/main/java/org/onap/osam/dto/ChassisDTO.java
new file mode 100644
index 0000000..96462cf
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/dto/ChassisDTO.java
@@ -0,0 +1,45 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.dto;

+

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonRootName;

+import lombok.AllArgsConstructor;

+import lombok.Data;

+import lombok.NoArgsConstructor;

+

+import java.util.List;

+

+@Data

+@AllArgsConstructor

+@NoArgsConstructor

+@JsonRootName("Chassis")

+@JsonInclude(JsonInclude.Include.NON_NULL)

+public class ChassisDTO {

+    private Long id;

+    private String clli;

+    private String pnfId;

+    private int shelf;

+    private int rack;

+    private List<OLTChassisDTO> olts;

+}

diff --git a/osam-core/web/src/main/java/org/onap/osam/dto/OLTChassisDTO.java b/osam-core/web/src/main/java/org/onap/osam/dto/OLTChassisDTO.java
new file mode 100644
index 0000000..1937e35
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/dto/OLTChassisDTO.java
@@ -0,0 +1,47 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.dto;

+

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonRootName;

+import lombok.AllArgsConstructor;

+import lombok.Data;

+import lombok.NoArgsConstructor;

+

+import java.util.List;

+

+@Data

+@AllArgsConstructor

+@NoArgsConstructor

+@JsonRootName("OLT")

+@JsonInclude(JsonInclude.Include.NON_NULL)

+public class OLTChassisDTO {

+    private String clli;

+    private String oltDriver;

+    private String oltType;

+    private int portNumber;

+    private String ipAddress;

+    private String name;

+    private List<OLTPortDTO> oltPorts;

+    private Long id;

+}

diff --git a/osam-core/web/src/main/java/org/onap/osam/dto/OLTPortDTO.java b/osam-core/web/src/main/java/org/onap/osam/dto/OLTPortDTO.java
new file mode 100644
index 0000000..1a376fa
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/dto/OLTPortDTO.java
@@ -0,0 +1,63 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.dto;

+

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonRootName;

+import lombok.AllArgsConstructor;

+import lombok.Getter;

+import lombok.NoArgsConstructor;

+import lombok.Setter;

+import org.onap.osam.model.dao.ActivityState;

+import org.onap.osam.model.dao.AdminState;

+

+import java.util.List;

+

+/**

+ * Created by cemturker on 03.10.2018.

+ */

+@Getter

+@Setter

+@NoArgsConstructor

+@AllArgsConstructor

+@JsonRootName("OLTPort")

+@JsonInclude(JsonInclude.Include.NON_NULL)

+public class OLTPortDTO {

+    private Long id;

+    private Integer portNumber;

+    private ActivityState portAuthState;

+    private AdminState adminState;

+    private List<ONTDTO> ontDevices;

+

+    @Override

+    public String toString() {

+        final StringBuilder sb = new StringBuilder("OLTPortDTO{");

+        sb.append("id=").append(id);

+        sb.append(", portNumber=").append(portNumber);

+        sb.append(", portAuthState=").append(portAuthState);

+        sb.append(", adminState=").append(adminState);

+        sb.append(", ontDevices=").append(ontDevices);

+        sb.append('}');

+        return sb.toString();

+    }

+}

diff --git a/osam-core/web/src/main/java/org/onap/osam/dto/ONTDTO.java b/osam-core/web/src/main/java/org/onap/osam/dto/ONTDTO.java
new file mode 100644
index 0000000..d21d9e3
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/dto/ONTDTO.java
@@ -0,0 +1,43 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.dto;

+

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonRootName;

+import lombok.AllArgsConstructor;

+import lombok.Data;

+import lombok.NoArgsConstructor;

+

+@Data

+@AllArgsConstructor

+@NoArgsConstructor

+@JsonRootName("ONTDevice")

+@JsonInclude(JsonInclude.Include.NON_NULL)

+public class ONTDTO {

+

+    private String clli;

+    private String serialNumber;

+    private int slotNumber;

+    private int portNumber;

+    private Long id;

+}

diff --git a/osam-core/web/src/main/java/org/onap/osam/helper/DTOMapper.java b/osam-core/web/src/main/java/org/onap/osam/helper/DTOMapper.java
new file mode 100644
index 0000000..3a8784f
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/helper/DTOMapper.java
@@ -0,0 +1,222 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.helper;

+

+import com.google.common.collect.Lists;

+import org.onap.osam.dto.AccessPodDTO;

+import org.onap.osam.dto.ChassisDTO;

+import org.onap.osam.dto.OLTChassisDTO;

+import org.onap.osam.dto.OLTPortDTO;

+import org.onap.osam.dto.ONTDTO;

+import org.onap.osam.model.dao.AccessPod;

+import org.onap.osam.model.dao.ActivityState;

+import org.onap.osam.model.dao.Chassis;

+import org.onap.osam.model.dao.OLTPort;

+import org.onap.osam.model.dao.OLTSlot;

+import org.onap.osam.model.dao.ONTDevice;

+import org.onap.osam.model.dao.OltDriver;

+import org.onap.osam.model.dao.OltType;

+

+import java.util.ArrayList;

+import java.util.List;

+import java.util.Map;

+import java.util.function.Function;

+import java.util.stream.Collectors;

+

+

+public final class DTOMapper {

+

+    private DTOMapper () {

+

+    }

+

+    public static Chassis convertToChassis (ChassisDTO chassisDTO) {

+        Chassis chassis = new Chassis();

+        chassis.setClli(chassisDTO.getClli());

+        chassis.setShelf(chassisDTO.getShelf());

+        chassis.setRack(chassisDTO.getRack());

+        chassis.setState(ActivityState.ACTIVE);

+        AccessPod accessPod = new AccessPod();

+        accessPod.setPnfId(chassisDTO.getPnfId());

+        chassis.setAccessPod(accessPod);

+        return chassis;

+    }

+

+

+

+

+    public static OLTSlot convertToOLT (OLTChassisDTO oltChassisDTO) {

+        OLTSlot oltSlot = new OLTSlot();

+        oltSlot.setIpAddress(oltChassisDTO.getIpAddress());

+        oltSlot.setPort(oltChassisDTO.getPortNumber());

+        oltSlot.setName(oltChassisDTO.getName());

+        oltSlot.setOltDriver(OltDriver.valueOf(oltChassisDTO.getOltDriver()));

+        oltSlot.setOltType(OltType.valueOf(oltChassisDTO.getOltType()));

+        return oltSlot;

+    }

+

+    public static ChassisDTO convertChassisToDTO(Chassis chassis) {

+        ChassisDTO chassisDTO = new ChassisDTO();

+        chassisDTO.setId(chassis.getId());

+        chassisDTO.setClli(chassis.getClli());

+        chassisDTO.setRack(chassis.getRack());

+        chassisDTO.setShelf(chassis.getShelf());

+        chassisDTO.setPnfId(chassis.getAccessPod().getPnfId());

+        return chassisDTO;

+    }

+

+    public static List<ChassisDTO> convertChassisToDTO(List<Chassis> chassises) {

+        return chassises.stream().map(x -> convertChassisToDTO(x)).collect(Collectors.toList());

+    }

+

+    public static Map<String, List<OLTChassisDTO>> convertFromOLT(List<OLTSlot> oltSlots){

+        return oltSlots.stream().map(x -> convertFromOLT(x)).collect(Collectors.toList()).stream().collect(Collectors.groupingBy(OLTChassisDTO::getClli));

+    }

+

+    public static OLTChassisDTO convertFromOLT (OLTSlot oltSlot) {

+        OLTChassisDTO oltChassisDTO = new OLTChassisDTO();

+        oltChassisDTO.setClli(oltSlot.getChassis().getClli());

+        oltChassisDTO.setIpAddress(oltSlot.getIpAddress());

+        oltChassisDTO.setName(oltSlot.getName());

+        oltChassisDTO.setOltDriver(oltSlot.getOltDriver().name());

+        oltChassisDTO.setOltType(oltSlot.getOltType().name());

+        oltChassisDTO.setPortNumber(oltSlot.getPort());

+        oltChassisDTO.setId(oltSlot.getId());

+        return oltChassisDTO;

+    }

+

+    public static ONTDTO convertFromONTDevice (ONTDevice ontDevice) {

+        ONTDTO ontdto = new ONTDTO();

+        ontdto.setSerialNumber(ontDevice.getSerialNumber());

+        ontdto.setPortNumber(ontDevice.getOLTPort().getPortNumber());

+        ontdto.setId(ontDevice.getId());

+        ontdto.setSlotNumber(ontDevice.getOLTPort().getOltSlot().getNumber());

+        ontdto.setClli(ontDevice.getOLTPort().getOltSlot().getChassis().getClli());

+        return ontdto;

+    }

+

+    public static Map<String, List<ONTDTO>> convertFromONTDevice(List<ONTDevice> ontDevices){

+        return ontDevices.stream().map(x -> convertFromONTDevice(x)).collect(Collectors.toList()).stream().collect(Collectors.groupingBy(ONTDTO::getClli));

+    }

+

+    public static AccessPod covertDtoToAccessPod(AccessPodDTO dto) {

+        //TODO validate..

+        AccessPod accessPod = new AccessPod();

+        accessPod.setPnfId(dto.getPnfId());

+        accessPod.setId(dto.getId());

+        accessPod.setCoreIp(dto.getCoreIp());

+        accessPod.setCorePort(dto.getCorePort());

+        accessPod.setUsername(dto.getUsername());

+        accessPod.setPassword(dto.getPassword());

+        accessPod.setIp(dto.getIp());

+        accessPod.setPort(dto.getPort());

+        return accessPod;

+    }

+

+    public static AccessPodDTO covertAccessPodToDto(AccessPod accessPod) {

+        //TODO validate..

+        AccessPodDTO dto = new AccessPodDTO();

+        dto.setPnfId(accessPod.getPnfId());

+        dto.setCoreIp(accessPod.getCoreIp());

+        dto.setCorePort(accessPod.getCorePort());

+        dto.setUsername(accessPod.getUsername());

+        dto.setPassword(accessPod.getPassword());

+        dto.setIp(accessPod.getIp());

+        dto.setId(accessPod.getId());

+        dto.setPort(accessPod.getPort());

+        return dto;

+    }

+

+    private static OLTPortDTO convertOLTPortToDTO(OLTPort oltPort) {

+        OLTPortDTO oltPortDTO = new OLTPortDTO();

+        oltPortDTO.setId(oltPort.getId());

+        oltPortDTO.setAdminState(oltPort.getAdminState());

+        oltPortDTO.setPortAuthState(oltPort.getPortAuthState());

+        oltPortDTO.setPortNumber(oltPort.getPortNumber());

+        return oltPortDTO;

+    }

+

+    public static List<AccessPodDTO> covertAccessPodsToDtos(List<AccessPod> accessPodList) {

+        //TODO validate..

+        List<AccessPodDTO> dtos = new ArrayList<>();

+        for (AccessPod accessPod : accessPodList) {

+            dtos.add(covertAccessPodToDto(accessPod));

+        }

+        return dtos;

+    }

+

+    public static AccessPodDTO representTheAccessPod(List<Chassis> chassisList, AccessPod accessPod) {

+        if (accessPod == null) {

+            return null;

+        }

+        AccessPodDTO accessPodDTO = covertAccessPodToDto(accessPod);

+        if (chassisList == null || chassisList.isEmpty()) {

+            return accessPodDTO;

+        }

+        List<ChassisDTO> chassisDTOS = new ArrayList<>();

+        accessPodDTO.setChassises(chassisDTOS);

+        for (Chassis chassis : chassisList) {

+            chassisDTOS.add(representTheChassis(chassis));

+        }

+        return accessPodDTO;

+    }

+

+    public static ChassisDTO representTheChassis(Chassis chassis) {

+        ChassisDTO chassisDTO = convertChassisToDTO(chassis);

+        if (chassis.getOltSlots() == null || chassis.getOltSlots().isEmpty()) {

+            return chassisDTO;

+        }

+        List<OLTChassisDTO> oltChassisDTOS = Lists.newArrayList();

+        chassisDTO.setOlts(oltChassisDTOS);

+        for (OLTSlot oltSlot : chassis.getOltSlots()) {

+            oltChassisDTOS.add(representTheOLTSlot(oltSlot));

+        }

+        return chassisDTO;

+    }

+

+    public static OLTChassisDTO representTheOLTSlot(OLTSlot oltSlot) {

+        OLTChassisDTO oltChassisDTO = convertFromOLT(oltSlot);

+        if (oltSlot.getOltPorts() == null || oltSlot.getOltPorts().isEmpty()) {

+            return oltChassisDTO;

+        }

+        List<OLTPortDTO> oltPortDTOS = Lists.newArrayList();

+        oltChassisDTO.setOltPorts(oltPortDTOS);

+        for (OLTPort oltPort : oltSlot.getOltPorts()) {

+            oltPortDTOS.add(representTheOLTPort(oltPort));

+        }

+        return oltChassisDTO;

+    }

+

+    public static OLTPortDTO representTheOLTPort(OLTPort oltPort) {

+        OLTPortDTO portDTO = convertOLTPortToDTO(oltPort);

+        if (oltPort.getOntDevices() == null || oltPort.getOntDevices().isEmpty()) {

+            return portDTO;

+        }

+        List<ONTDTO> ontdtos = Lists.newArrayList();

+        portDTO.setOntDevices(ontdtos);

+        for (ONTDevice ontDevice : oltPort.getOntDevices()) {

+            ontdtos.add(convertFromONTDevice(ontDevice));

+        }

+        return portDTO;

+    }

+}