-/*******************************************************************************
+/*
* ============LICENSE_START========================================================================
* ONAP : ccsdk feature sdnr wt
* =================================================================================================
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
* ============LICENSE_END==========================================================================
- ******************************************************************************/
+ */
package org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.test;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.Optional;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.SeverityType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.devicemanager.rev190109.PushFaultNotificationInputBuilder;
public class TestMapping {
return SeverityType.forName(faultSeverity); // <-- mapping provided by generated classes. Manual mapping beneficial.
}
- private String updateFaultPayload(String faultNodeId, String faultCounter, String faultOccurrenceTime, String faultObjectId,
- String faultReason, String faultSeverity) throws JsonProcessingException {
+ private String updateFaultPayload(String faultNodeId, String faultCounter, String faultOccurrenceTime,
+ String faultObjectId, String faultReason, String faultSeverity) throws JsonProcessingException {
PushFaultNotificationInputBuilder faultNotificationBuilder = new PushFaultNotificationInputBuilder();
faultNotificationBuilder.setNodeId(faultNodeId);
faultNotificationBuilder.setTimestamp(new DateAndTime(faultOccurrenceTime));
faultNotificationBuilder.setObjectId(faultObjectId);
faultNotificationBuilder.setProblem(faultReason);
- Optional<SeverityType> oSeverity = getSeverity(faultSeverity); //TODO getSeverity
+ Optional<SeverityType> oSeverity = getSeverity(faultSeverity);
if (oSeverity.isPresent()) {
faultNotificationBuilder.setSeverity(oSeverity.get());
} else {
public void test() throws JsonProcessingException {
DateAndTime dt = new DateAndTime("2017-03-01T09:15:00.0Z");
- String result = updateFaultPayload("f1","34",dt.getValue(),"fefef","reason","Critical");
+ String result = updateFaultPayload("f1", "34", dt.getValue(), "fefef", "reason", "Critical");
- System.out.println("Res: "+result);
- }
+ System.out.println("Res: " + result);
+ }
}