Commit 8997793b authored by Yann Garcia's avatar Yann Garcia
Browse files

Bug fixed in meep-iot & meep-sss-mgr

parent 5428721a
Loading
Loading
Loading
Loading
+3 −0
Changes for etsi-mec-sandbox.code-workspace: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -11,6 +11,9 @@
		},
		{
			"path": "../tmp/doc2oas"
		},
		{
			"path": "../etsi-mec-sandbox.STF678_Task1_2_3_4"
		}
	],
	"extensions": {
+161 −20
Changes for go-apps/meep-iot/sbi/iot-sbi.go: 161 added lines, 20 removed lines.
Original line number Diff line number Diff line
@@ -134,12 +134,19 @@ type TrafficRuleDescriptor struct {

type InterfaceDescriptor struct {
	InterfaceType string
	//TunnelInfo *TunnelInfo FSCOM Not supported
	TunnelInfo    *TunnelInfo
	SrcMACAddress string
	DstMACAddress string
	DstIPAddress  string
}

type TunnelInfo struct {
	TunnelType         string
	TunnelDstAddress   string
	TunnelSrcAddress   string
	TunnelSpecificData string
}

type TrafficFilter struct {
	SrcAddress       []string
	DstAddress       []string
@@ -163,6 +170,43 @@ type KeyValuePair struct {
	Value string
}

type DownlinkInfo struct {
	DownlinkTopic string
	DevicePort    int32
}

type DeviceSpecificMessageFormats struct {
	EventMsgFormat  *EventMsg
	UplinkMsgFormat *UplinkMsg
}

type EventMsg struct {
	EventTopic            string
	SelectedSerializer    *string
	IncludeDeviceAddr     bool
	IncludeDeviceMetadata bool
	IncludePei            bool
	IncludeSupi           bool
	IncludeImei           bool
	IncludeImsi           bool
	IncludeIccid          bool
	IncludeDeviceId       bool
}

type UplinkMsg struct {
	UplinkTopic           string
	SelectedSerializer    *string
	IncludeDevicePort     bool
	IncludeDeviceAddr     bool
	IncludeDeviceMetadata bool
	IncludePei            bool
	IncludeSupi           bool
	IncludeImei           bool
	IncludeImsi           bool
	IncludeIccid          bool
	IncludeDeviceId       bool
}

type DeviceInfo struct {
	DeviceAuthenticationInfo     string
	DeviceMetadata               []KeyValuePair
@@ -177,8 +221,8 @@ type DeviceInfo struct {
	RequestedMecTrafficRule      []TrafficRuleDescriptor
	RequestedIotPlatformId       string
	RequestedUserTransportId     string
	//DeviceSpecificMessageFormats *DeviceSpecificMessageFormats
	//DownlinkInfo *DownlinkInfo
	DeviceSpecificMessageFormats *DeviceSpecificMessageFormats
	DownlinkInfo                 *DownlinkInfo
	ClientCertificate            string
	Enabled                      bool
}
@@ -579,18 +623,67 @@ func convertDeviceInfoFromIotMgr(dev tm.DeviceInfo) (device DeviceInfo) {
			}
			if v.DstInterface != nil {
				device.RequestedMecTrafficRule[i].DstInterface = &InterfaceDescriptor{
					InterfaceType: device.RequestedMecTrafficRule[i].DstInterface.InterfaceType,
					// FIXME FSCOM To be filled: TunnelInfo:    nil,
					SrcMACAddress: device.RequestedMecTrafficRule[i].DstInterface.SrcMACAddress,
					DstMACAddress: device.RequestedMecTrafficRule[i].DstInterface.DstMACAddress,
					DstIPAddress:  device.RequestedMecTrafficRule[i].DstInterface.DstIPAddress,
					InterfaceType: v.DstInterface.InterfaceType,
					SrcMACAddress: v.DstInterface.SrcMACAddress,
					DstMACAddress: v.DstInterface.DstMACAddress,
					DstIPAddress:  v.DstInterface.DstIPAddress,
				}
				if v.DstInterface.TunnelInfo != nil {
					device.RequestedMecTrafficRule[i].DstInterface.TunnelInfo = &TunnelInfo{
						TunnelType:         v.DstInterface.TunnelInfo.TunnelType,
						TunnelDstAddress:   v.DstInterface.TunnelInfo.TunnelDstAddress,
						TunnelSrcAddress:   v.DstInterface.TunnelInfo.TunnelSrcAddress,
						TunnelSpecificData: v.DstInterface.TunnelInfo.TunnelSpecificData,
					}
				}
			}
		} // End of 'for' statement
	}
	// FIXME FSCOM Add missing fileds (pointers & arrays)
	//DeviceSpecificMessageFormats *DeviceSpecificMessageFormats `json:"deviceSpecificMessageFormats,omitempty"`
	//DownlinkInfo *DownlinkInfo `json:"downlinkInfo,omitempty"`
	if dev.DeviceSpecificMessageFormats != nil {
		var deviceSpecificMessageFormats = DeviceSpecificMessageFormats{}
		if dev.DeviceSpecificMessageFormats.EventMsgFormat != nil {
			deviceSpecificMessageFormats.EventMsgFormat = &EventMsg{
				EventTopic:            dev.DeviceSpecificMessageFormats.EventMsgFormat.EventTopic,
				IncludeDeviceAddr:     dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeDeviceAddr,
				IncludeDeviceMetadata: dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeDeviceMetadata,
				IncludePei:            dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludePei,
				IncludeSupi:           dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeSupi,
				IncludeImei:           dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeImei,
				IncludeImsi:           dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeImsi,
				IncludeIccid:          dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeIccid,
				IncludeDeviceId:       dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeDeviceId,
			}
			if dev.DeviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer != nil {
				s := *dev.DeviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer
				deviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer = &s
			}
		}
		if dev.DeviceSpecificMessageFormats.UplinkMsgFormat != nil {
			deviceSpecificMessageFormats.UplinkMsgFormat = &UplinkMsg{
				UplinkTopic:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.UplinkTopic,
				IncludeDevicePort:     dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDevicePort,
				IncludeDeviceAddr:     dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDeviceAddr,
				IncludeDeviceMetadata: dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDeviceMetadata,
				IncludePei:            dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludePei,
				IncludeSupi:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeSupi,
				IncludeImei:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeImei,
				IncludeImsi:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeImsi,
				IncludeIccid:          dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeIccid,
				IncludeDeviceId:       dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDeviceId,
			}
			if dev.DeviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer != nil {
				s := *dev.DeviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer
				deviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer = &s
			}
		}
		device.DeviceSpecificMessageFormats = &deviceSpecificMessageFormats
	}
	if dev.DownlinkInfo != nil {
		device.DownlinkInfo = &DownlinkInfo{
			DownlinkTopic: dev.DownlinkInfo.DownlinkTopic,
			DevicePort:    dev.DownlinkInfo.DevicePort,
		}
	}

	//log.Debug("convertDeviceInfoFromIotMgr: device: ", device)

@@ -666,19 +759,67 @@ func convertDeviceInfoToIotMgr(dev DeviceInfo) (device tm.DeviceInfo) {
			}
			if v.DstInterface != nil {
				device.RequestedMecTrafficRule[i].DstInterface = &tm.InterfaceDescriptor{
					InterfaceType: device.RequestedMecTrafficRule[i].DstInterface.InterfaceType,
					// FIXME FSCOM To be filled: TunnelInfo:    nil,
					SrcMACAddress: device.RequestedMecTrafficRule[i].DstInterface.SrcMACAddress,
					DstMACAddress: device.RequestedMecTrafficRule[i].DstInterface.DstMACAddress,
					DstIPAddress:  device.RequestedMecTrafficRule[i].DstInterface.DstIPAddress,
					InterfaceType: v.DstInterface.InterfaceType,
					SrcMACAddress: v.DstInterface.SrcMACAddress,
					DstMACAddress: v.DstInterface.DstMACAddress,
					DstIPAddress:  v.DstInterface.DstIPAddress,
				}
				if v.DstInterface.TunnelInfo != nil {
					device.RequestedMecTrafficRule[i].DstInterface.TunnelInfo = &tm.TunnelInfo{
						TunnelType:         v.DstInterface.TunnelInfo.TunnelType,
						TunnelDstAddress:   v.DstInterface.TunnelInfo.TunnelDstAddress,
						TunnelSrcAddress:   v.DstInterface.TunnelInfo.TunnelSrcAddress,
						TunnelSpecificData: v.DstInterface.TunnelInfo.TunnelSpecificData,
					}
				}
			}
		} // End of 'for' statement
	}
	// FIXME FSCOM Add missing fileds (pointers & arrays)
	//DeviceSpecificMessageFormats *DeviceSpecificMessageFormats `json:"deviceSpecificMessageFormats,omitempty"`
	//DownlinkInfo *DownlinkInfo `json:"downlinkInfo,omitempty"`

	if dev.DeviceSpecificMessageFormats != nil {
		var deviceSpecificMessageFormats = tm.DeviceSpecificMessageFormats{}
		if dev.DeviceSpecificMessageFormats.EventMsgFormat != nil {
			deviceSpecificMessageFormats.EventMsgFormat = &tm.EventMsg{
				EventTopic:            dev.DeviceSpecificMessageFormats.EventMsgFormat.EventTopic,
				IncludeDeviceAddr:     dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeDeviceAddr,
				IncludeDeviceMetadata: dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeDeviceMetadata,
				IncludePei:            dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludePei,
				IncludeSupi:           dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeSupi,
				IncludeImei:           dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeImei,
				IncludeImsi:           dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeImsi,
				IncludeIccid:          dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeIccid,
				IncludeDeviceId:       dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeDeviceId,
			}
			if dev.DeviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer != nil {
				s := *dev.DeviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer
				deviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer = &s
			}
		}
		if dev.DeviceSpecificMessageFormats.UplinkMsgFormat != nil {
			deviceSpecificMessageFormats.UplinkMsgFormat = &tm.UplinkMsg{
				UplinkTopic:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.UplinkTopic,
				IncludeDevicePort:     dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDevicePort,
				IncludeDeviceAddr:     dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDeviceAddr,
				IncludeDeviceMetadata: dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDeviceMetadata,
				IncludePei:            dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludePei,
				IncludeSupi:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeSupi,
				IncludeImei:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeImei,
				IncludeImsi:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeImsi,
				IncludeIccid:          dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeIccid,
				IncludeDeviceId:       dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDeviceId,
			}
			if dev.DeviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer != nil {
				s := *dev.DeviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer
				deviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer = &s
			}
		}
		device.DeviceSpecificMessageFormats = &deviceSpecificMessageFormats
	}
	if dev.DownlinkInfo != nil {
		device.DownlinkInfo = &tm.DownlinkInfo{
			DownlinkTopic: dev.DownlinkInfo.DownlinkTopic,
			DevicePort:    dev.DownlinkInfo.DevicePort,
		}
	}
	//log.Debug("convertDeviceInfoToIotMgr: device: ", device)

	return device
+128 −16
Changes for go-apps/meep-iot/server/meep-iot.go: 128 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -1247,18 +1247,81 @@ func convertDeviceInfoFromSbi(dev sbi.DeviceInfo) (device DeviceInfo) {
			}
			if v.DstInterface != nil {
				device.RequestedMecTrafficRule[i].DstInterface = &InterfaceDescriptor{
					InterfaceType: device.RequestedMecTrafficRule[i].DstInterface.InterfaceType,
					TunnelInfo:    nil, // FIXME FSCOM To be filled
					SrcMACAddress: device.RequestedMecTrafficRule[i].DstInterface.SrcMACAddress,
					DstMACAddress: device.RequestedMecTrafficRule[i].DstInterface.DstMACAddress,
					DstIPAddress:  device.RequestedMecTrafficRule[i].DstInterface.DstIPAddress,
					InterfaceType: v.DstInterface.InterfaceType,
					SrcMACAddress: v.DstInterface.SrcMACAddress,
					DstMACAddress: v.DstInterface.DstMACAddress,
					DstIPAddress:  v.DstInterface.DstIPAddress,
				}
				if v.DstInterface.TunnelInfo != nil {
					device.RequestedMecTrafficRule[i].DstInterface.TunnelInfo = &TunnelInfo{
						TunnelType:         v.DstInterface.TunnelInfo.TunnelType,
						TunnelDstAddress:   v.DstInterface.TunnelInfo.TunnelDstAddress,
						TunnelSrcAddress:   v.DstInterface.TunnelInfo.TunnelSrcAddress,
						TunnelSpecificData: v.DstInterface.TunnelInfo.TunnelSpecificData,
					}
				}
			}
		} // End of 'for' statement
	}
	// FIXME FSCOM Add missing fileds (pointers & arrays)
	//DeviceSpecificMessageFormats *DeviceSpecificMessageFormats `json:"deviceSpecificMessageFormats,omitempty"`
	//DownlinkInfo *DownlinkInfo `json:"downlinkInfo,omitempty"`
	if dev.DeviceSpecificMessageFormats != nil {
		var deviceSpecificMessageFormats = DeviceSpecificMessageFormats{}
		if dev.DeviceSpecificMessageFormats.EventMsgFormat != nil {
			deviceSpecificMessageFormats.EventMsgFormat = &EventMsg{
				EventTopic:            dev.DeviceSpecificMessageFormats.EventMsgFormat.EventTopic,
				IncludeDeviceAddr:     dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeDeviceAddr,
				IncludeDeviceMetadata: dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeDeviceMetadata,
				IncludePei:            dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludePei,
				IncludeSupi:           dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeSupi,
				IncludeImei:           dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeImei,
				IncludeImsi:           dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeImsi,
				IncludeIccid:          dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeIccid,
				IncludeDeviceId:       dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeDeviceId,
			}
			if dev.DeviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer != nil {
				var s SerializerType
				if *dev.DeviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer == "JSON" {
					s = JSON
				} else if *dev.DeviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer == "XML" {
					s = XML
				} else {
					s = PROTOBUF3
				}
				deviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer = &s
			}
		}
		if dev.DeviceSpecificMessageFormats.UplinkMsgFormat != nil {
			deviceSpecificMessageFormats.UplinkMsgFormat = &UplinkMsg{
				UplinkTopic:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.UplinkTopic,
				IncludeDevicePort:     dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDevicePort,
				IncludeDeviceAddr:     dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDeviceAddr,
				IncludeDeviceMetadata: dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDeviceMetadata,
				IncludePei:            dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludePei,
				IncludeSupi:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeSupi,
				IncludeImei:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeImei,
				IncludeImsi:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeImsi,
				IncludeIccid:          dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeIccid,
				IncludeDeviceId:       dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDeviceId,
			}
			if dev.DeviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer != nil {
				var s SerializerType
				if *dev.DeviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer == "JSON" {
					s = JSON
				} else if *dev.DeviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer == "XML" {
					s = XML
				} else {
					s = PROTOBUF3
				}
				deviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer = &s
			}
		}
		device.DeviceSpecificMessageFormats = &deviceSpecificMessageFormats
	}
	if dev.DownlinkInfo != nil {
		device.DownlinkInfo = &DownlinkInfo{
			DownlinkTopic: dev.DownlinkInfo.DownlinkTopic,
			DevicePort:    dev.DownlinkInfo.DevicePort,
		}
	}

	//log.Debug("convertDeviceInfosFromSbi: devices: ", devices)
	return device
@@ -1371,18 +1434,67 @@ func convertDeviceInfoToSbi(dev DeviceInfo) (device sbi.DeviceInfo) {
			}
			if v.DstInterface != nil {
				device.RequestedMecTrafficRule[i].DstInterface = &sbi.InterfaceDescriptor{
					InterfaceType: device.RequestedMecTrafficRule[i].DstInterface.InterfaceType,
					// FIXME FSCOM To be filled: TunnelInfo:    nil,
					SrcMACAddress: device.RequestedMecTrafficRule[i].DstInterface.SrcMACAddress,
					DstMACAddress: device.RequestedMecTrafficRule[i].DstInterface.DstMACAddress,
					DstIPAddress:  device.RequestedMecTrafficRule[i].DstInterface.DstIPAddress,
					InterfaceType: v.DstInterface.InterfaceType,
					SrcMACAddress: v.DstInterface.SrcMACAddress,
					DstMACAddress: v.DstInterface.DstMACAddress,
					DstIPAddress:  v.DstInterface.DstIPAddress,
				}
				if v.DstInterface.TunnelInfo != nil {
					device.RequestedMecTrafficRule[i].DstInterface.TunnelInfo = &sbi.TunnelInfo{
						TunnelType:         v.DstInterface.TunnelInfo.TunnelType,
						TunnelDstAddress:   v.DstInterface.TunnelInfo.TunnelDstAddress,
						TunnelSrcAddress:   v.DstInterface.TunnelInfo.TunnelSrcAddress,
						TunnelSpecificData: v.DstInterface.TunnelInfo.TunnelSpecificData,
					}
				}
			}
		} // End of 'for' statement
	}
	// FIXME FSCOM Add missing fileds (pointers & arrays)
	//DeviceSpecificMessageFormats *DeviceSpecificMessageFormats `json:"deviceSpecificMessageFormats,omitempty"`
	//DownlinkInfo *DownlinkInfo `json:"downlinkInfo,omitempty"`
	if dev.DeviceSpecificMessageFormats != nil {
		var deviceSpecificMessageFormats = sbi.DeviceSpecificMessageFormats{}
		if dev.DeviceSpecificMessageFormats.EventMsgFormat != nil {
			deviceSpecificMessageFormats.EventMsgFormat = &sbi.EventMsg{
				EventTopic:            dev.DeviceSpecificMessageFormats.EventMsgFormat.EventTopic,
				IncludeDeviceAddr:     dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeDeviceAddr,
				IncludeDeviceMetadata: dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeDeviceMetadata,
				IncludePei:            dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludePei,
				IncludeSupi:           dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeSupi,
				IncludeImei:           dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeImei,
				IncludeImsi:           dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeImsi,
				IncludeIccid:          dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeIccid,
				IncludeDeviceId:       dev.DeviceSpecificMessageFormats.EventMsgFormat.IncludeDeviceId,
			}
			if dev.DeviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer != nil {
				var s string = string(*dev.DeviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer)
				deviceSpecificMessageFormats.EventMsgFormat.SelectedSerializer = &s
			}
		}
		if dev.DeviceSpecificMessageFormats.UplinkMsgFormat != nil {
			deviceSpecificMessageFormats.UplinkMsgFormat = &sbi.UplinkMsg{
				UplinkTopic:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.UplinkTopic,
				IncludeDevicePort:     dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDevicePort,
				IncludeDeviceAddr:     dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDeviceAddr,
				IncludeDeviceMetadata: dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDeviceMetadata,
				IncludePei:            dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludePei,
				IncludeSupi:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeSupi,
				IncludeImei:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeImei,
				IncludeImsi:           dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeImsi,
				IncludeIccid:          dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeIccid,
				IncludeDeviceId:       dev.DeviceSpecificMessageFormats.UplinkMsgFormat.IncludeDeviceId,
			}
			if dev.DeviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer != nil {
				var s string = string(*dev.DeviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer)
				deviceSpecificMessageFormats.UplinkMsgFormat.SelectedSerializer = &s
			}
		}
		device.DeviceSpecificMessageFormats = &deviceSpecificMessageFormats
	}
	if dev.DownlinkInfo != nil {
		device.DownlinkInfo = &sbi.DownlinkInfo{
			DownlinkTopic: dev.DownlinkInfo.DownlinkTopic,
			DevicePort:    dev.DownlinkInfo.DevicePort,
		}
	}

	//log.Debug("convertDeviceInfoToSbi: devices: ", devices)
	return device
+75 −27

File changed.

Preview size limit exceeded, changes collapsed.

+61 −9
Changes for go-packages/meep-iot-mgr/iot-mgr.go: 61 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -105,12 +105,19 @@ type TrafficRuleDescriptor struct {

type InterfaceDescriptor struct {
	InterfaceType string
	//TunnelInfo *TunnelInfo FSCOM Not supported
	TunnelInfo    *TunnelInfo
	SrcMACAddress string
	DstMACAddress string
	DstIPAddress  string
}

type TunnelInfo struct {
	TunnelType         string
	TunnelDstAddress   string
	TunnelSrcAddress   string
	TunnelSpecificData string
}

type TrafficFilter struct {
	SrcAddress       []string
	DstAddress       []string
@@ -134,6 +141,43 @@ type KeyValuePair struct {
	Value string
}

type DownlinkInfo struct {
	DownlinkTopic string
	DevicePort    int32
}

type DeviceSpecificMessageFormats struct {
	EventMsgFormat  *EventMsg
	UplinkMsgFormat *UplinkMsg
}

type EventMsg struct {
	EventTopic            string
	SelectedSerializer    *string
	IncludeDeviceAddr     bool
	IncludeDeviceMetadata bool
	IncludePei            bool
	IncludeSupi           bool
	IncludeImei           bool
	IncludeImsi           bool
	IncludeIccid          bool
	IncludeDeviceId       bool
}

type UplinkMsg struct {
	UplinkTopic           string
	SelectedSerializer    *string
	IncludeDevicePort     bool
	IncludeDeviceAddr     bool
	IncludeDeviceMetadata bool
	IncludePei            bool
	IncludeSupi           bool
	IncludeImei           bool
	IncludeImsi           bool
	IncludeIccid          bool
	IncludeDeviceId       bool
}

type DeviceInfo struct {
	DeviceAuthenticationInfo     string
	DeviceMetadata               []KeyValuePair
@@ -148,8 +192,8 @@ type DeviceInfo struct {
	RequestedMecTrafficRule      []TrafficRuleDescriptor
	RequestedIotPlatformId       string
	RequestedUserTransportId     string
	//DeviceSpecificMessageFormats *DeviceSpecificMessageFormats
	//DownlinkInfo *DownlinkInfo
	DeviceSpecificMessageFormats *DeviceSpecificMessageFormats
	DownlinkInfo                 *DownlinkInfo
	ClientCertificate            string
	Enabled                      bool
}
@@ -424,12 +468,6 @@ func (tm *IotMgr) CreateDevice(device DeviceInfo) (deviceResp DeviceInfo, err er
	tm.wg.Wait()
	log.Info("CreateDevice: After Wait()")

	// RequestedMecTrafficRule is not supported yet
	if len(device.RequestedMecTrafficRule) != 0 {
		err = errors.New("Unsupported traffic rule provided")
		log.Error(err.Error())
		return deviceResp, err
	}
	if len(device.RequestedIotPlatformId) != 0 {
		deviceResp, err = tm.createDeviceWithIotPlatformId(device, device.RequestedIotPlatformId)
	} else {
@@ -559,6 +597,20 @@ func (tm *IotMgr) createDeviceWithRequestedUserTransportId(device DeviceInfo, re
		log.Error("createDeviceWithIotPlatformId: ", err.Error())
		return deviceResp, err
	}
	// FIXME FSCOM How to manage these fields from DeviceInfo
	// 	DeviceAuthenticationInfo string
	// 	Gpsi                     string
	// 	Pei                      string
	// 	Supi                     string
	// 	Msisdn                   string
	// 	Imei                     string
	// 	Imsi                     string
	// 	Iccid                    string
	// 	RequestedMecTrafficRule  []TrafficRuleDescriptor
	// 	//DeviceSpecificMessageFormats *DeviceSpecificMessageFormats
	// 	//DownlinkInfo *DownlinkInfo
	// 	ClientCertificate string
	// }
	log.Info("createDeviceWithIotPlatformId: deviceResp: ", deviceResp)

	return deviceResp, nil
Loading