2  * Copyright (C) 2020 Huawei, Inc. and others. All rights reserved.
 
   4  * Licensed under the Apache License, Version 2.0 (the "License");
 
   5  * you may not use this file except in compliance with the License.
 
   6  * You may obtain a copy of the License at
 
   8  *     http://www.apache.org/licenses/LICENSE-2.0
 
  10  * Unless required by applicable law or agreed to in writing, software
 
  11  * distributed under the License is distributed on an "AS IS" BASIS,
 
  12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  13  * See the License for the specific language governing permissions and
 
  14  * limitations under the License.
 
  16 package org.onap.usecaseui.server.service.lcm.impl;
 
  18 import okhttp3.MediaType;
 
  19 import okhttp3.Request;
 
  20 import okhttp3.RequestBody;
 
  21 import okhttp3.Response;
 
  22 import okhttp3.ResponseBody;
 
  24 import okio.BufferedSource;
 
  25 import okio.ByteString;
 
  29 import okio.TypedOptions;
 
  30 import org.jetbrains.annotations.NotNull;
 
  31 import org.junit.Before;
 
  32 import org.junit.Test;
 
  33 import org.onap.usecaseui.server.bean.lcm.sotne2eservice.E2EServiceInstanceRequest;
 
  34 import org.onap.usecaseui.server.bean.lcm.sotne2eservice.ModelConfig;
 
  35 import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService;
 
  36 import org.onap.usecaseui.server.service.lcm.domain.so.SOService;
 
  37 import org.onap.usecaseui.server.service.lcm.domain.so.bean.DeleteOperationRsp;
 
  38 import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation;
 
  39 import retrofit2.Call;
 
  40 import retrofit2.Callback;
 
  42 import jakarta.annotation.Nullable;
 
  43 import java.io.IOException;
 
  44 import java.io.InputStream;
 
  45 import java.nio.ByteBuffer;
 
  46 import java.nio.charset.Charset;
 
  47 import java.util.HashMap;
 
  49 import static org.mockito.Mockito.any;
 
  50 import static org.mockito.Mockito.anyString;
 
  51 import static org.mockito.Mockito.mock;
 
  52 import static org.mockito.Mockito.when;
 
  53 import static org.onap.usecaseui.server.util.CallStub.failedCall;
 
  55 public class SotnServiceTemplateServiceImplTest {
 
  57     AAIService aaiService;
 
  59     ServiceOperation serviceOperation;
 
  60     SotnServiceTemplateServiceImpl sotnServiceTemplateService;
 
  63     public void before() throws Exception {
 
  64         aaiService = mock(AAIService.class);
 
  65         soService = mock(SOService.class);
 
  66         sotnServiceTemplateService = new SotnServiceTemplateServiceImpl();
 
  67         sotnServiceTemplateService.setSoService(soService);
 
  68         sotnServiceTemplateService.setAaiService(aaiService);
 
  72     public void instantiate_CCVPN_ServiceTest() {
 
  74         HashMap<String, Object> map = new HashMap<>();
 
  76         map.put("description","23");
 
  77         map.put("l2vpn","34");
 
  78         map.put("sotnUni","45");
 
  79         Call<ServiceOperation> call = getSosCall();
 
  80         when(soService.instantiateSOTNService(any(E2EServiceInstanceRequest.class))).thenReturn(call);
 
  81         sotnServiceTemplateService.instantiate_CCVPN_Service(map);
 
  85     public void instantiate_CCVPN_ServiceWithThrowException() {
 
  86         HashMap<String, Object> map = new HashMap<>();
 
  88         map.put("description","23");
 
  89         map.put("l2vpn","34");
 
  90         map.put("sotnUni","45");
 
  91         Call<ServiceOperation> call = getSosCall();
 
  92         when(soService.instantiateSOTNService(any(E2EServiceInstanceRequest.class))).thenReturn(call);
 
  93         sotnServiceTemplateService.instantiate_CCVPN_Service(map);
 
  97     public void createSotnServiceTest() {
 
  98         Call<ServiceOperation> call = getSosCall();
 
  99         when(soService.instantiateSOTNService(any(E2EServiceInstanceRequest.class))).thenReturn(call);
 
 100         sotnServiceTemplateService.createSotnService(new E2EServiceInstanceRequest());
 
 104     public void createSotnServiceWithThrowException() {
 
 105         Call<ServiceOperation> call = getSosCall();
 
 106         when(soService.instantiateSOTNService(any(E2EServiceInstanceRequest.class))).thenReturn(call);
 
 107         sotnServiceTemplateService.createSotnService(new E2EServiceInstanceRequest());
 
 111     public void getServiceInstancesInfoTest() throws Exception {
 
 112         Call<ResponseBody> call = getAaiCall("ServiceInstance");
 
 113         when(aaiService.getServiceInstancesForEdge("ISAAC","SOTN","ISAAC")).thenReturn(call);
 
 114         sotnServiceTemplateService.getServiceInstancesInfo("ISAAC","SOTN","ISAAC");
 
 118     public void getServiceInstancesInfoWithThrowException() throws Exception {
 
 119         Call<ResponseBody> call = getAaiCall("ServiceInstance");
 
 120         when(aaiService.getServiceInstancesForEdge("ISAAC","SOTN","ISAAC")).thenReturn(call);
 
 121         sotnServiceTemplateService.getServiceInstancesInfo("ISAAC","SOTN","ISAAC");
 
 125     public void getTerminationPointTest() throws Exception {
 
 126         Call<ResponseBody> call = getAaiCall("Pinterface");
 
 127         when(aaiService.getTerminationPoint("SOTN","123")).thenReturn(call);
 
 128         sotnServiceTemplateService.getTerminationPoint("SOTN", "123");
 
 132     public void getTerminationPointWithThrowException() throws Exception {
 
 133         Call<ResponseBody> call = getAaiCall("Pinterface");
 
 134         when(aaiService.getTerminationPoint("SOTN","123")).thenReturn(call);
 
 135         sotnServiceTemplateService.getTerminationPoint("SOTN", "123");
 
 139     public void getSOTNPinterfaceByVpnIdTest() throws Exception {
 
 140         Call<ResponseBody> call = getAaiCall("VpnBinding");
 
 142         when(aaiService.getPinterfaceByVpnId("1")).thenReturn(call);
 
 143         sotnServiceTemplateService.getSOTNPinterfaceByVpnId("1");
 
 147     public void getSOTNPinterfaceByVpnIdWithThrowException() throws Exception {
 
 148         Call<ResponseBody> call = getAaiCall("VpnBinding");
 
 149         when(aaiService.getPinterfaceByVpnId("1")).thenReturn(call);
 
 150         sotnServiceTemplateService.getSOTNPinterfaceByVpnId("1");
 
 154     public void getSOTNPnfTest() throws Exception {
 
 155         Call<ResponseBody> call = getAaiCall("Pnf");
 
 156         when(aaiService.getPnfInfo("test")).thenReturn(call);
 
 157         sotnServiceTemplateService.getSOTNPnf("test");
 
 161     public void getSOTNPnfWithThrowException() throws Exception {
 
 162         Call<ResponseBody> call = getAaiCall("Pnf");
 
 163         when(aaiService.getPnfInfo("test")).thenReturn(call);
 
 164         sotnServiceTemplateService.getSOTNPnf("test");
 
 168     public void getSOTNLinkbyNameTest() throws Exception {
 
 169         Call<ResponseBody> call = getAaiCall("LogicalLink");
 
 170         when(aaiService.getSpecificLogicalLink("link")).thenReturn(call);
 
 171         sotnServiceTemplateService.getSOTNLinkbyName("link");
 
 175     public void getSOTNLinkbyNameWithThrowException() throws Exception {
 
 176         Call<ResponseBody> call = getAaiCall("LogicalLink");
 
 177         when(aaiService.getSpecificLogicalLink("link")).thenReturn(call);
 
 178         sotnServiceTemplateService.getSOTNLinkbyName("link");
 
 183     public void getUNIInfoTest() throws Exception {
 
 184         Call<ResponseBody> call = getAaiCall("Uni");
 
 185         when(aaiService.getUNIInfo("uni-id")).thenReturn(call);
 
 186         sotnServiceTemplateService.getUNIInfo("uni-id");
 
 189     public void getUNIInfoWithThrowException() throws Exception {
 
 190         Call<ResponseBody> call = getAaiCall("Uni");
 
 191         when(aaiService.getUNIInfo("uni-id")).thenReturn(call);
 
 192         sotnServiceTemplateService.getUNIInfo("uni-id");
 
 195     public void getVnfsTest() throws Exception {
 
 196         Call<ResponseBody> call = getAaiCall("Vnfs");
 
 197         when(aaiService.getVNFsDetail("vnf-id")).thenReturn(call);
 
 198         sotnServiceTemplateService.getVnfs("vnf-id");
 
 201     public void getVnfsWithThrowException() throws Exception {
 
 202         Call<ResponseBody> call = getAaiCall("Vnfs");
 
 203         when(aaiService.getVNFsDetail("vnf-id")).thenReturn(call);
 
 204         sotnServiceTemplateService.getVnfs("vnf-id");
 
 207     public void getReadFile_unniTest() throws Exception {
 
 208         ModelConfig mdl = new ModelConfig();
 
 209         sotnServiceTemplateService.readFile_unni();
 
 212     public void getReadFileTest() throws Exception {
 
 213         ModelConfig mdl = new ModelConfig();
 
 214         sotnServiceTemplateService.readFile();
 
 219     public void getSOTNSiteInformationTopologyTest() throws Exception {
 
 220         Call<ResponseBody> call = getAaiCall("ServiceInstance");
 
 221         Call<ResponseBody> call1 = getAaiCall("AllottedResource");
 
 222         Call<ResponseBody> call2 = getAaiCall("SiteResource");
 
 223         Call<ResponseBody> call3 = getAaiCall("Connectivity");
 
 224         Call<ResponseBody> call4 = getAaiCall("ComplexObj");
 
 225         Call<ResponseBody> call5 = getAaiCall("Pinterface");
 
 226         when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
 
 227         when(aaiService.getSiteResourceInfo(anyString())).thenReturn(call2);
 
 228         when(aaiService.getConnectivityInformation(anyString())).thenReturn(call3);
 
 229         when(aaiService.getAllotedResourceFor5G(anyString(),anyString(),anyString(),anyString())).thenReturn(call1);
 
 230         when(aaiService.getComplexObject(anyString())).thenReturn(call4);
 
 231         when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(call5);
 
 232         sotnServiceTemplateService.getSOTNSiteInformationTopology("SOTN", "ISAAC");
 
 235     public void getSOTNSiteInformationTopologyWithThrowException() throws Exception {
 
 236         Call<ResponseBody> call = getAaiCall("ServiceInstance");
 
 237         Call<ResponseBody> call1 = getAaiCall("AllottedResource");
 
 238         Call<ResponseBody> call2 = getAaiCall("SiteResource");
 
 239         Call<ResponseBody> call3 = getAaiCall("Connectivity");
 
 240         Call<ResponseBody> call4 = getAaiCall("ComplexObj");
 
 241         Call<ResponseBody> call5 = getAaiCall("Pinterface");
 
 242         when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
 
 243         when(aaiService.getSiteResourceInfo(anyString())).thenReturn(call2);
 
 244         when(aaiService.getConnectivityInformation(anyString())).thenReturn(call3);
 
 245         when(aaiService.getAllotedResourceFor5G(anyString(),anyString(),anyString(),anyString())).thenReturn(call1);
 
 246         when(aaiService.getComplexObject(anyString())).thenReturn(call4);
 
 247         when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(call5);
 
 248         sotnServiceTemplateService.getSOTNSiteInformationTopology("SOTN", "ISAAC");
 
 251     public void getServiceTest() throws Exception {
 
 252         Call<ResponseBody> call = getAaiCall("ServiceInstance");
 
 253         Call<ResponseBody> call1 = getAaiCall("AllottedResource");
 
 254         Call<ResponseBody> call2 = getAaiCall("SiteResource");
 
 255         Call<ResponseBody> call3 = getAaiCall("Connectivity");
 
 256         Call<ResponseBody> call4 = getAaiCall("ComplexObj");
 
 257         when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
 
 258         when(aaiService.getSiteResourceInfo(anyString())).thenReturn(call2);
 
 259         when(aaiService.getConnectivityInformation(anyString())).thenReturn(call3);
 
 260         when(aaiService.getAllotedResourceFor5G(anyString(),anyString(),anyString(),anyString())).thenReturn(call1);
 
 261         when(aaiService.getComplexObject(anyString())).thenReturn(call4);
 
 262         sotnServiceTemplateService.getService("SOTN", "ISAAC");
 
 265     public void getServiceWithThrowException() throws Exception {
 
 266         Call<ResponseBody> call = getAaiCall("ServiceInstance");
 
 267         ResponseBody result = null;
 
 268         when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
 
 269         ResponseBody result1 = null;
 
 270         when(aaiService.getConnectivityInformation("1")).thenReturn(failedCall("Failed to get connectivity"));
 
 271         ResponseBody result2 = null;
 
 272         when(aaiService.getAllotedResourceFor5G("1", "SONT", "ISAAC", "2")).thenReturn(failedCall("failed to get allocated resource"));
 
 273         sotnServiceTemplateService.getService("SOTN", "ISAAC");
 
 276     public void getSOTNServiceInformationTopologyTest() throws Exception {
 
 277         Call<ResponseBody> call = getAaiCall("ServiceInstance");
 
 278         Call<ResponseBody> call1 = getAaiCall("Uni");
 
 279         Call<ResponseBody> call2 = getAaiCall("Vnfs");
 
 280         Call<ResponseBody> call3 = getAaiCall("Connectivity");
 
 281         Call<ResponseBody> call4 = getAaiCall("Pinterface");
 
 282         Call<ResponseBody> call5 = getAaiCall("VpnBinding");
 
 283         when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
 
 284         when(aaiService.getUNIInfo(anyString())).thenReturn(call1);
 
 285         when(aaiService.getVNFsDetail(anyString())).thenReturn(call2);
 
 286         when(aaiService.getConnectivityInformation(anyString())).thenReturn(call3);
 
 287         when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(call4);
 
 288         when(aaiService.getPinterfaceByVpnId(anyString())).thenReturn(call5);
 
 289         sotnServiceTemplateService.getServiceInformationTopology("example-service-type-val-52265", "NNI-001");
 
 292     public void getSOTNServiceInformationTopologyWithThrowException() throws Exception {
 
 293         Call<ResponseBody> call = getAaiCall("ServiceInstance");
 
 294         Call<ResponseBody> call1 = getAaiCall("Uni");
 
 295         Call<ResponseBody> call2 = getAaiCall("Vnfs");
 
 296         Call<ResponseBody> call3 = getAaiCall("Connectivity");
 
 297         Call<ResponseBody> call4 = getAaiCall("Pinterface");
 
 298         Call<ResponseBody> call5 = getAaiCall("VpnBinding");
 
 299         when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(call);
 
 300         when(aaiService.getUNIInfo(anyString())).thenReturn(call1);
 
 301         when(aaiService.getVNFsDetail(anyString())).thenReturn(call2);
 
 302         when(aaiService.getConnectivityInformation(anyString())).thenReturn(call3);
 
 303         when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(call4);
 
 304         when(aaiService.getPinterfaceByVpnId(anyString())).thenReturn(call5);
 
 305         sotnServiceTemplateService.getServiceInformationTopology("SOTN", "ISAAC");
 
 310     public void getVPNBindingInformationTopologyTest() throws Exception {
 
 311         Call<ResponseBody> call = getAaiCall("VpnBinding");
 
 312         when(aaiService.getPinterfaceByVpnId(anyString())).thenReturn(call);
 
 313         Call<ResponseBody> call1 = getAaiCall("Pinterface");
 
 314         when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(call1);
 
 315         sotnServiceTemplateService.getVPNBindingInformationTopology("example-service-type-val-52265", "NNI-001", "vpn-bind-1");
 
 318     public void getVPNBindingInformationTopologyWithThrowException() throws Exception {
 
 319         Call<ResponseBody> call = getAaiCall("VpnBinding");
 
 320         when(aaiService.getPinterfaceByVpnId(anyString())).thenReturn(call);
 
 321         Call<ResponseBody> call1 = getAaiCall("Pinterface");
 
 322         when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(call1);
 
 323         sotnServiceTemplateService.getVPNBindingInformationTopology("example-service-type-val-52265", "NNI-001", "vpn-bind-1");
 
 327     public void deleteServiceTest() throws Exception {
 
 328         Call<ResponseBody> aaiCall = getAaiCall("ServiceInstance");
 
 329         Call<DeleteOperationRsp> sosCall = getDeleteSosCall();
 
 330         Response result = null;
 
 331         RequestBody requestBody = null;
 
 332         when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(aaiCall);
 
 333         when(soService.terminateService(anyString(),any(RequestBody.class))).thenReturn(sosCall);
 
 334         sotnServiceTemplateService.deleteService("NNI-001", "vpn-bind-1");
 
 337     public void deleteServiceWithThrowException() throws Exception {
 
 338         Call<ResponseBody> aaiCall = getAaiCall("ServiceInstance");
 
 339         Call<ServiceOperation> sosCall = getSosCall();
 
 340         Response result = null;
 
 341         RequestBody requestBody = null;
 
 342         when(aaiService.getServiceInstancesForEdge("ISAAC", "example-service-type-val-52265", "NNI-001")).thenReturn(aaiCall);
 
 343         when(soService.terminateService("serviceId",requestBody)).thenReturn(failedCall("failed to delete the server."));
 
 344         sotnServiceTemplateService.deleteService("NNI-001", "vpn-bind-1");
 
 347     public void getNodeTest() throws Exception {
 
 348         sotnServiceTemplateService.getNode("001", "vpn-bind-1","image.png");
 
 351     public void getEdgeTest() throws Exception {
 
 352         sotnServiceTemplateService.getEdge("fromid", "toId");
 
 356     public void getSOTNResourceInformationTopologyTest() throws Exception {
 
 357         Call<ResponseBody> aaiCall = getAaiCall("ServiceInstance");
 
 358         Call<ResponseBody> aaiCall1 = getAaiCall("Connectivity");
 
 359         Call<ResponseBody> aaiCall2 = getAaiCall("Pnf");
 
 360         Call<ResponseBody> aaiCall3 = getAaiCall("Pinterface");
 
 361         Call<ResponseBody> aaiCall4 = getAaiCall("VpnBinding");
 
 362         Call<ResponseBody> aaiCall5 = getAaiCall("LogicalLink");
 
 363         when(aaiService.getServiceInstancesForEdge(anyString(),anyString(),anyString())).thenReturn(aaiCall);
 
 364         when(aaiService.getConnectivityInformation( anyString())).thenReturn(aaiCall1);
 
 365         when(aaiService.getPnfInfo(anyString())).thenReturn(aaiCall2);
 
 366         when(aaiService.getTerminationPoint(anyString(),anyString())).thenReturn(aaiCall3);
 
 367         when(aaiService.getPinterfaceByVpnId(anyString())).thenReturn(aaiCall4);
 
 368         when(aaiService.getSpecificLogicalLink(anyString())).thenReturn(aaiCall5);
 
 369         sotnServiceTemplateService.getSOTNResourceInformationTopology("example-service-type-val-52265", "NNI-001");
 
 372     public void getSOTNResourceInformationTopologyWithThrowException() throws Exception {
 
 373         ResponseBody result = null;
 
 374         when(aaiService.getServiceInstancesForEdge("ISAAC", "example-service-type-val-52265", "NNI-001")).thenReturn(failedCall("failed to get sotn resource topology."));
 
 375         sotnServiceTemplateService.getSOTNResourceInformationTopology("example-service-type-val-52265", "NNI-001");
 
 379     private Call<ServiceOperation> getSosCall(){
 
 380         Call<ServiceOperation> call = new Call<ServiceOperation>() {
 
 383             public retrofit2.Response<ServiceOperation> execute() throws IOException {
 
 384                 ServiceOperation serviceOperation=new ServiceOperation();
 
 385                 return retrofit2.Response.success(serviceOperation);
 
 389             public void enqueue(Callback<ServiceOperation> callback) {
 
 394             public boolean isExecuted() {
 
 399             public void cancel() {
 
 404             public boolean isCanceled() {
 
 409             public Call<ServiceOperation> clone() {
 
 414             public Request request() {
 
 420     private Call<DeleteOperationRsp> getDeleteSosCall(){
 
 421         Call<DeleteOperationRsp> call = new Call<DeleteOperationRsp>() {
 
 423             public retrofit2.Response<DeleteOperationRsp> execute() throws IOException {
 
 424                 DeleteOperationRsp deleteOperationRsp = new DeleteOperationRsp();
 
 425                 return retrofit2.Response.success(deleteOperationRsp);
 
 429             public void enqueue(Callback<DeleteOperationRsp> callback) {
 
 434             public boolean isExecuted() {
 
 439             public void cancel() {
 
 444             public boolean isCanceled() {
 
 449             public Call<DeleteOperationRsp> clone() {
 
 454             public Request request() {
 
 460     private Call<ResponseBody> getAaiCall(String t){
 
 461         Call<ResponseBody> call = new Call<ResponseBody>() {
 
 463             public retrofit2.Response<ResponseBody> execute() throws IOException {
 
 464                 ResponseBody responseBody= new ResponseBody() {
 
 467                     public MediaType contentType() {
 
 472                     public long contentLength() {
 
 474                         // TODO: 2021/1/21 长度
 
 475                         if(t.equals("ServiceInstance")){
 
 477                         }else if(t.equals("Connectivity")){
 
 479                         }else if(t.equals("Pinterface")){
 
 481                         }else if(t.equals("AllottedResource")){
 
 483                         }else if(t.equals("SiteResource")){
 
 485                         }else if(t.equals("ComplexObj")){
 
 487                         }else if(t.equals("VpnBinding")){
 
 489                         }else if(t.equals("Pnf")){
 
 491                         }else if(t.equals("LogicalLink")){
 
 493                         }else if(t.equals("Uni")){
 
 495                         }else if(t.equals("Vnfs")){
 
 502                     public BufferedSource source() {
 
 503                         BufferedSource bufferedSource = new BufferedSource() {
 
 505                             @org.jetbrains.annotations.Nullable
 
 507                             public <T> T select(@NotNull TypedOptions<T> typedOptions) throws IOException {
 
 513                             public BufferedSource peek() {
 
 519                             public Buffer getBuffer() {
 
 524                             public long read(Buffer buffer, long l) throws IOException {
 
 529                             public Timeout timeout() {
 
 534                             public void close() throws IOException {
 
 539                             public boolean isOpen() {
 
 544                             public int read(ByteBuffer dst) throws IOException {
 
 549                             public Buffer buffer() {
 
 554                             public boolean exhausted() throws IOException {
 
 559                             public void require(long l) throws IOException {
 
 564                             public boolean request(long l) throws IOException {
 
 569                             public byte readByte() throws IOException {
 
 574                             public short readShort() throws IOException {
 
 579                             public short readShortLe() throws IOException {
 
 584                             public int readInt() throws IOException {
 
 589                             public int readIntLe() throws IOException {
 
 594                             public long readLong() throws IOException {
 
 599                             public long readLongLe() throws IOException {
 
 604                             public long readDecimalLong() throws IOException {
 
 609                             public long readHexadecimalUnsignedLong() throws IOException {
 
 614                             public void skip(long l) throws IOException {
 
 619                             public ByteString readByteString() throws IOException {
 
 624                             public ByteString readByteString(long l) throws IOException {
 
 629                             public int select(Options options) throws IOException {
 
 634                             public byte[] readByteArray() throws IOException {
 
 635                                 // TODO: 2021/1/21 字符串
 
 636                                 String s = new String();
 
 637                                 if(t.equals("ServiceInstance")){
 
 638                                     s = "{\"service-instance-id\":\"234\",\"service-instance-name\":18,\"input-parameters\":\"as\",\"service-type\":1591851786568,\"relationship-list\":{\"relationship\":[{\"related-to\":\"service-instance\",\"related-link\":\"12/0\"},{\"related-to\":\"generic-vnf\",\"related-link\":\"12/0\"},{\"related-to\":\"allotted-resource\",\"related-link\":\"12/0\"},{\"related-to\":\"connectivity\",\"related-link\":\"12/0\"},{\"related-to\":\"site-resource\",\"related-link\":\"12/0\"}]}}";
 
 639                                 }else if(t.equals("Connectivity")){
 
 640                                     s = "{\"connectivity-id\":\"234\",\"bandwidth-profile-name\":18,\"cir\":1591851786568,\"relationship-list\":{\"relationship\":[{\"related-to\":\"vpn-binding\",\"related-link\":\"12/0\"}]}}";
 
 641                                 }else if(t.equals("Pinterface")){
 
 642                                     s = "{\"interface-name\":\"234\",\"speed-units\":18,\"port-description\":1591851786568," +
 
 643                                             "\"speed-value\":\"234\",\"equipment-identifier\":18,\"resource-version\":1591851786568," +
 
 644                                             "\"in-maint\":\"true\",\"network-ref\":\"23\",\"transparent\":\"34\",\"operational-status\":\"34\",\"relationship-list\":{\"relationship\":[{\"related-to\":\"logical-link\",\"related-link\":\"12/0\"}]}}";
 
 645                                 }else if(t.equals("AllottedResource")){
 
 646                                     s = "{\"id\":234,\"selflink\":18,\"model-invariant-id\":12}";
 
 647                                 }else if(t.equals("SiteResource")){
 
 648                                     s = "{\"site-resource-id\":\"234\",\"site-resource-name\":18,\"description\":12,\"relationship-list\":{\"relationship\":[{\"related-to\":\"complex\",\"related-link\":\"123/0\"}]}}";
 
 649                                 }else if(t.equals("ComplexObj")){
 
 650                                     s = "{\"physical-location-id\":\"234\",\"resource-version\":18,\"physical-location-type\":12,\"city\":\"sd\",\"postal-code\":\"ds\"}";
 
 651                                 }else if(t.equals("VpnBinding")){
 
 652                                     s = "{\"vpn-binding\":[{\"vpn-id\":23,\"src-access-node-id\":18,\"dst-access-node-id\":18,\"relationship-list\":{\"relationship\":[{\"related-to\":\"p-interface\",\"relationship-data\":[{\"relationship-key\":\"pnf.pnf-name\",\"relationship-value\":\"23\"}],\"related-link\":\"123/2\"}]}}]}";
 
 653                                 }else if(t.equals("Pnf")){
 
 654                                     s = "{\"pnf-name\":\"234\",\"pnf-id\":18,\"in-maint\":true}";
 
 655                                 }else if(t.equals("LogicalLink")){
 
 656                                     s = "{\"link-name\":\"234\",\"in-maint\":18,\"link-type\":true,\"relationship-list\":{\"relationship\":[{\"related-to\":\"p-interface\",\"relationship-data\":[{\"relationship-key\":\"pnf.pnf-name\",\"relationship-value\":\"26\"}],\"related-link\":\"123/0\"},{\"related-to\":\"ext-aai-network\",\"related-link\":\"123/0\"}]}}";;
 
 657                                 }else if(t.equals("Uni")){
 
 658                                     s = "{\"id\":\"234\",\"tpId\":18,\"resource-version\":true,\"relationship-list\":{\"relationship\":[{\"related-to\":\"p-interface\",\"relationship-data\":[{\"relationship-key\":\"pnf.pnf-name\",\"relationship-value\":\"26\"}],\"related-link\":\"123/0\"}]}}";
 
 659                                 }else if(t.equals("Vnfs")){
 
 660                                     s = "{\"vnf-id\":\"234\",\"in-maint\":18,\"resource-version\":true,\"relationship-list\":{\"relationship\":[{\"related-to\":\"connectivity\",\"related-link\":\"123/0\"},{\"related-to\":\"uni\",\"related-link\":\"123/0\"}]}}";
 
 662                                 byte[] bytes = s.getBytes();
 
 667                             public byte[] readByteArray(long l) throws IOException {
 
 672                             public int read(byte[] bytes) throws IOException {
 
 677                             public void readFully(byte[] bytes) throws IOException {
 
 682                             public int read(byte[] bytes, int i, int i1) throws IOException {
 
 687                             public void readFully(Buffer buffer, long l) throws IOException {
 
 692                             public long readAll(Sink sink) throws IOException {
 
 697                             public String readUtf8() throws IOException {
 
 702                             public String readUtf8(long l) throws IOException {
 
 708                             public String readUtf8Line() throws IOException {
 
 713                             public String readUtf8LineStrict() throws IOException {
 
 718                             public String readUtf8LineStrict(long l) throws IOException {
 
 723                             public int readUtf8CodePoint() throws IOException {
 
 728                             public String readString(Charset charset) throws IOException {
 
 733                             public String readString(long l, Charset charset) throws IOException {
 
 738                             public long indexOf(byte b) throws IOException {
 
 743                             public long indexOf(byte b, long l) throws IOException {
 
 748                             public long indexOf(byte b, long l, long l1) throws IOException {
 
 753                             public long indexOf(ByteString byteString) throws IOException {
 
 758                             public long indexOf(ByteString byteString, long l) throws IOException {
 
 763                             public long indexOfElement(ByteString byteString) throws IOException {
 
 768                             public long indexOfElement(ByteString byteString, long l) throws IOException {
 
 773                             public boolean rangeEquals(long l, ByteString byteString) throws IOException {
 
 778                             public boolean rangeEquals(long l, ByteString byteString, int i, int i1) throws IOException {
 
 783                             public InputStream inputStream() {
 
 787                         return bufferedSource;
 
 790                 return retrofit2.Response.success(200,responseBody);
 
 794             public void enqueue(Callback<ResponseBody> callback) {
 
 799             public boolean isExecuted() {
 
 804             public void cancel() {
 
 809             public boolean isCanceled() {
 
 814             public Call<ResponseBody> clone() {
 
 819             public Request request() {