Commit 1610498f authored by Yann Garcia's avatar Yann Garcia
Browse files

Enhance MEC-016 development with image/command field in AppInfoList

parent 4f109a83
Loading
Loading
Loading
Loading
+0 −82
Original line number Diff line number Diff line
@@ -389,88 +389,6 @@ func GetAllListAppList() (appListSbi *map[string]*tm.AppInfoList, err error) {
	log.Debug("appListSbi: ", appListSbi)
	log.Debug("len(appListSbi): ", len(*appListSbi))

	// appListSbi = new(tm.tm.AppInfoList)
	// appListSbi.AppList = make([]tm.AppInfoSbi, len(obj))
	// i := 0
	// for _, item := range obj {
	// 	//log.Debug("obj: i=", i, " item= ", item)
	// 	//log.Debug("===> item.AppDId= ", item.AppDId)
	// 	appListSbi.AppList[i].AppDId = item.AppDId
	// 	appListSbi.AppList[i].AppName = item.AppName
	// 	appListSbi.AppList[i].AppProvider = item.AppProvider
	// 	appListSbi.AppList[i].AppSoftVersion = item.AppSoftVersion
	// 	appListSbi.AppList[i].AppDVersion = item.AppDVersion
	// 	appListSbi.AppList[i].AppDescription = item.AppDescription

	// 	if len(item.AppLocation) != 0 {
	// 		appListSbi.AppList[i].AppLocation = make([]tm.LocationConstraintsItem, len(item.AppLocation))
	// 		for j, item1 := range item.AppLocation {
	// 			//log.Debug("item1: ", item1)
	// 			if item1.Area != nil {
	// 				appListSbi.AppList[i].AppLocation[j].Area = new(tm.Polygon)
	// 				appListSbi.AppList[i].AppLocation[j].Area.Coordinates = item1.Area.Coordinates
	// 			} else {
	// 				appListSbi.AppList[i].AppLocation[j].Area = nil
	// 			}
	// 			if item1.CivicAddressElement != nil {
	// 				appListSbi.AppList[i].AppLocation[j].CivicAddressElement = make([]tm.CivicAddressElementItem, len(*item1.CivicAddressElement))
	// 				for k, cv := range *item1.CivicAddressElement {
	// 					appListSbi.AppList[i].AppLocation[j].CivicAddressElement[k].CaType = cv.CaType
	// 					appListSbi.AppList[i].AppLocation[j].CivicAddressElement[k].CaValue = cv.CaValue
	// 				}
	// 			} else {
	// 				appListSbi.AppList[i].AppLocation[j].CivicAddressElement = nil
	// 			}
	// 			if item1.CountryCode != nil {
	// 				appListSbi.AppList[i].AppLocation[j].CountryCode = new(string)
	// 				appListSbi.AppList[i].AppLocation[j].CountryCode = item1.CountryCode
	// 			} else {
	// 				appListSbi.AppList[i].AppLocation[j].CountryCode = nil
	// 			}
	// 		} // End of 'for' statement
	// 	}

	// 	if len(item.AppCharcs) != 0 {
	// 		appListSbi.AppList[i].AppCharcs = make([]tm.AppCharcs, len(item.AppCharcs))
	// 		for j, item2 := range item.AppCharcs {
	// 			//log.Debug("item2: ", item2)
	// 			if item2.Memory != nil {
	// 				appListSbi.AppList[i].AppCharcs[j].Memory = new(uint32)
	// 				*appListSbi.AppList[i].AppCharcs[j].Memory = *item2.Memory
	// 			} else {
	// 				appListSbi.AppList[i].AppCharcs[j].Memory = nil
	// 			}
	// 			if item2.Storage != nil {
	// 				appListSbi.AppList[i].AppCharcs[j].Storage = new(uint32)
	// 				*appListSbi.AppList[i].AppCharcs[j].Storage = *item2.Storage
	// 			} else {
	// 				appListSbi.AppList[i].AppCharcs[j].Storage = nil
	// 			}
	// 			if item2.Latency != nil {
	// 				appListSbi.AppList[i].AppCharcs[j].Latency = new(uint32)
	// 				*appListSbi.AppList[i].AppCharcs[j].Latency = *item2.Latency
	// 			} else {
	// 				appListSbi.AppList[i].AppCharcs[j].Latency = nil
	// 			}
	// 			if item2.Bandwidth != nil {
	// 				appListSbi.AppList[i].AppCharcs[j].Bandwidth = new(uint32)
	// 				*appListSbi.AppList[i].AppCharcs[j].Bandwidth = *item2.Bandwidth
	// 			} else {
	// 				appListSbi.AppList[i].AppCharcs[j].Bandwidth = nil
	// 			}
	// 			if item2.ServiceCont != nil {
	// 				appListSbi.AppList[i].AppCharcs[j].ServiceCont = new(uint32)
	// 				*appListSbi.AppList[i].AppCharcs[j].ServiceCont = *item2.ServiceCont
	// 			} else {
	// 				appListSbi.AppList[i].AppCharcs[j].ServiceCont = nil
	// 			}
	// 		} // End of 'for' statement
	// 	}

	// 	// Process next item
	// 	i = i + 1
	// } // End of 'for' statement

	//sbi.updateAppInfoCB(appListSbi)
	return appListSbi, nil
}
+24 −35
Original line number Diff line number Diff line
@@ -490,10 +490,10 @@ const (
	callbackReference1 = "callbackReference1"
	//appLocationUpdates1   = true
	//appAutoInstantiation1 = false
	appName1        = "onboarded-demo4"
	appProvider1    = "ETSI"
	appDVersion1    = "v0.1.0"
	appDescription1 = "Basic HTTP Ping Pong"
	appName1        = "appName1"
	appProvider1    = "appProvider1"
	appDVersion1    = "appDVersion1"
	appDescription1 = "appDescription1"

	//associateDevAppId2    = "associateDevAppId2"
	callbackReference2 = "callbackReference2"
@@ -506,38 +506,23 @@ const (
)

var ( // Need to take address
	contextId1        string = "onboarded-demo4"
	appDId1           string = "onboarded-demo4"
	appSoftVersion1   string = "v0.1.0"
	contextId1        string = "contextId1"
	appDId1           string = "appDId1"
	appSoftVersion1   string = "appSoftVersion1"
	appPackageSource1 string = "appPackageSource1"
	//appInstanceId1_1     string         = "appInstanceId1-1"
	//appInstanceId1_2     string         = "appInstanceId1-2"
	//appInstanceId1_3     string         = "appInstanceId1-3"
	referenceURI1_1 meepdaimgr.Uri = "referenceURI1-1"
	//referenceURI1_3      meepdaimgr.Uri = "referenceURI1-3"
	area1 = Polygon{[][][]float32{{{7.420433, 43.729942}, {7.420659, 43.73036}, {7.420621, 43.731045}, {7.420922, 43.73129}}, {{7.420434, 43.729943}, {7.420659, 43.73036}, {7.420621, 43.731045}, {7.420922, 43.73129}}}}
	//civicAddressElement1        = []LocationConstraintsCivicAddressElement{{1, "Value1"}, {10, "Value10"}}
	countryCode1 string = "33"
	memory1      int32  = 1024
	storage1     int32  = 1024
	latency1     int32  = 1024
	bandwidth1   int32  = 1024
	serviceCont1 int32  = 0

	//contextId2           string = "contextId2"
	//appDId2         string = "appDId2"
	//appSoftVersion2 string = "appSoftVersion2"
	//appPackageSource2    string = "appPackageSource2"
	//appInstanceId2_1     string = "appInstanceId2-1"
	//appInstanceId2_2     string = "appInstanceId2-2"
	//area2                       = Polygon{[][][]float32{{{7.43166, 43.736156}, {7.431723, 43.736115}, {7.431162, 43.735607}, {7.430685, 43.73518}}}}
	//civicAddressElement2        = []LocationConstraintsCivicAddressElement{{2, "Value2"}, {20, "Value20"}}
	//countryCode2         string = "countryCode2"
	//memory2              int32  = 1024 * 2
	//storage2             int32  = 1024 * 2
	//latency2             int32  = 1024 * 2
	//bandwidth2           int32  = 1024 * 2
	//serviceCont2         int32  = 0
	area1 = Polygon{[][][]float32{{{7.43166, 43.736156}, {7.431723, 43.736115}, {7.431162, 43.735607}, {7.430685, 43.73518}}}}
	civicAddressElement1        = []LocationConstraintsCivicAddressElement{{2, "Value2"}, {20, "Value20"}}
	countryCode1 string = "countryCode1"
	memory1      int32  = 1024 * 2
	storage1     int32  = 1024 * 2
	latency1     int32  = 1024 * 2
	bandwidth1   int32  = 1024 * 2
	serviceCont1 int32  = 1
)

func TestNotImplemented(t *testing.T) {
@@ -575,9 +560,11 @@ func TestAppListGET(t *testing.T) {
	/******************************
	 * expected response section
	 ******************************/
	// Fill LocationConstraints table
	appLocationConstraints := make([]LocationConstraints, 1)
	appLocationConstraints[0] = LocationConstraints{nil, nil, countryCode1}
	// Fill LocationConstraints
	appLocationConstraints := make([]LocationConstraints, 2)
	appLocationConstraints[0] = LocationConstraints{&area1, make([]LocationConstraintsCivicAddressElement, 0), countryCode1}
	appLocationConstraints[1] = LocationConstraints{nil, make([]LocationConstraintsCivicAddressElement, 1), ""}
	appLocationConstraints[1].CivicAddressElement = civicAddressElement1
	// Fill ApplicationListAppInfo
	var appInfo ApplicationListAppInfo
	appInfo.AppDId = appDId1
@@ -805,7 +792,8 @@ func testDevAppContextsPOST(t *testing.T) *AppContext {
	 * expected response section
	 ******************************/
	// Fill LocationConstraints
	var expected_appLocationConstraints = LocationConstraints{&area1, make([]LocationConstraintsCivicAddressElement, 0), countryCode1}
	var expected_appLocationConstraints = LocationConstraints{&area1, make([]LocationConstraintsCivicAddressElement, 1), countryCode1}
	expected_appLocationConstraints.CivicAddressElement = civicAddressElement1
	// Fill UserAppInstanceInfo
	expected_appContextAppInfoUserAppInstanceInfo := make([]AppContextAppInfoUserAppInstanceInfo, 1)
	expected_appContextAppInfoUserAppInstanceInfo[0].AppLocation = &expected_appLocationConstraints
@@ -837,7 +825,8 @@ func testDevAppContextsPOST(t *testing.T) *AppContext {
	 * request body section
	 ******************************/
	// Fill LocationConstraints
	var appLocationConstraints = LocationConstraints{&area1, make([]LocationConstraintsCivicAddressElement, 0), countryCode1}
	var appLocationConstraints = LocationConstraints{&area1, make([]LocationConstraintsCivicAddressElement, 1), countryCode1}
	expected_appLocationConstraints.CivicAddressElement = civicAddressElement1
	// Fill UserAppInstanceInfo
	appContextAppInfoUserAppInstanceInfo := make([]AppContextAppInfoUserAppInstanceInfo, 1)
	appContextAppInfoUserAppInstanceInfo[0].AppLocation = &appLocationConstraints
+99 −236

File changed.

Preview size limit exceeded, changes collapsed.

+150 −62

File changed.

Preview size limit exceeded, changes collapsed.