Merge changes from topic "nbinotification"
[transportpce.git] / nbinotifications / src / test / java / org / opendaylight / transportpce / nbinotifications / utils / NotificationServiceDataUtils.java
1 /*
2  * Copyright © 2020 Orange, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.transportpce.nbinotifications.utils;
9
10 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.NodeIdType;
11 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ConnectionType;
12 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.RxDirection;
13 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.endpoint.TxDirection;
14 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.lgx.LgxBuilder;
15 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.PortBuilder;
16 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State;
17 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
18 import org.opendaylight.yang.gen.v1.nbi.notifications.rev201130.NotificationService;
19 import org.opendaylight.yang.gen.v1.nbi.notifications.rev201130.NotificationServiceBuilder;
20 import org.opendaylight.yang.gen.v1.nbi.notifications.rev201130.notification.service.ServiceAEndBuilder;
21 import org.opendaylight.yang.gen.v1.nbi.notifications.rev201130.notification.service.ServiceZEndBuilder;
22 import org.opendaylight.yangtools.yang.common.Uint32;
23
24 public final class NotificationServiceDataUtils {
25
26     private NotificationServiceDataUtils() {
27     }
28
29     public static NotificationService buildSendEventInput() {
30         NotificationServiceBuilder notificationServiceBuilder = new NotificationServiceBuilder()
31                 .setMessage("message")
32                 .setServiceName("service1")
33                 .setOperationalState(State.InService)
34                 .setResponseFailed("")
35                 .setCommonId("commond-id")
36                 .setConnectionType(ConnectionType.Service)
37                 .setServiceZEnd(getServiceZEndBuild().build())
38                 .setServiceAEnd(getServiceAEndBuild().build());
39
40         return notificationServiceBuilder.build();
41     }
42
43     public static org.opendaylight.yang.gen.v1
44         .nbi.notifications.rev201130.get.notifications.service.output.NotificationService buildReceivedEvent() {
45         org.opendaylight.yang.gen.v1
46             .nbi.notifications.rev201130.get.notifications.service.output.NotificationServiceBuilder
47             notificationServiceBuilder = new org.opendaylight.yang.gen.v1
48             .nbi.notifications.rev201130.get.notifications.service.output.NotificationServiceBuilder()
49                 .setMessage("message")
50                 .setServiceName("service1")
51                 .setOperationalState(State.InService)
52                 .setResponseFailed("")
53                 .setCommonId("commond-id")
54                 .setConnectionType(ConnectionType.Service)
55                 .setServiceZEnd(getServiceZEndBuild().build())
56                 .setServiceAEnd(getServiceAEndBuild().build());
57
58         return notificationServiceBuilder.build();
59     }
60
61     public static ServiceAEndBuilder getServiceAEndBuild() {
62         return new ServiceAEndBuilder()
63                 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate(Uint32.valueOf(1))
64                 .setNodeId(new NodeIdType("XPONDER-1-2"))
65                 .setTxDirection(getTxDirection())
66                 .setRxDirection(getRxDirection());
67     }
68
69     public static ServiceZEndBuilder getServiceZEndBuild() {
70         return new ServiceZEndBuilder()
71                 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate(Uint32.valueOf(1))
72                 .setNodeId(new NodeIdType("XPONDER-1-2"))
73                 .setTxDirection(getTxDirection())
74                 .setRxDirection(getRxDirection());
75     }
76
77     private static TxDirection getTxDirection() {
78         return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
79                 .endpoint.TxDirectionBuilder().setPort(new PortBuilder().setPortDeviceName("device name")
80                 .setPortName("port name").setPortRack("port rack").setPortShelf("port shelf")
81                 .setPortSlot("port slot").setPortSubSlot("port subslot").setPortType("port type").build())
82                 .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name").setLgxPortName("lgx port name")
83                         .setLgxPortRack("lgx port rack").setLgxPortShelf("lgx port shelf").build())
84                 .build();
85     }
86
87     private static RxDirection getRxDirection() {
88         return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service
89                 .endpoint.RxDirectionBuilder()
90                 .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
91                         .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
92                         .setPortSubSlot("port subslot").setPortType("port type").build())
93                 .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name")
94                         .setLgxPortName("lgx port name").setLgxPortRack("lgx port rack")
95                         .setLgxPortShelf("lgx port shelf").build())
96                 .build();
97     }
98 }