Commit 9010af9f authored by Simon Pastor's avatar Simon Pastor Committed by Kevin Di Lallo
Browse files

physical locations and apps with network characteristics (dynamically...

physical locations and apps with network characteristics (dynamically changeable through event) and mobility event for physical locations
parent 0f025739
Loading
Loading
Loading
Loading
+51 −14
Original line number Diff line number Diff line
@@ -661,6 +661,23 @@ definitions:
        type: "array"
        items:
          $ref: "#/definitions/Process"
      linkLatency:
        type: "integer"
        description: "Latency in ms between the physical location and the network\
          \ (wired interface, air interface)"
      linkLatencyVariation:
        type: "integer"
        description: "Latency variation in ms between the physical location and the\
          \ network (wired interface, air interface)"
      linkThroughput:
        type: "integer"
        description: "The limit of the traffic supported between the physical location\
          \ and the network (wired interface, air interface)"
      linkPacketLoss:
        type: "number"
        format: "double"
        description: "Packet lost (in terms of percentage) between the physical location\
          \ and the network (wired interface, air interface)"
    description: "Physical location object"
    example: {}
  Process:
@@ -727,6 +744,19 @@ definitions:
        description: "Key/Value Pair Map (string, string)"
        additionalProperties:
          type: "string"
      appLatency:
        type: "integer"
        description: "Latency in ms caused by the application"
      appLatencyVariation:
        type: "integer"
        description: "Latency variation in ms caused by the application"
      appThroughput:
        type: "integer"
        description: "The limit of the traffic supported by the application"
      appPacketLoss:
        type: "number"
        format: "double"
        description: "Packet lost (in terms of percentage) caused by the application"
    description: "Application or service object"
    example: {}
  ServiceConfig:
@@ -855,13 +885,13 @@ definitions:
        description: "Event type"
        enum:
        - "NETWORK-CHARACTERISTICS-UPDATE"
        - "UE-MOBILITY"
        - "MOBILITY"
        - "POAS-IN-RANGE"
        - "OTHER"
      eventNetworkCharacteristicsUpdate:
        $ref: "#/definitions/EventNetworkCharacteristicsUpdate"
      eventUeMobility:
        $ref: "#/definitions/EventUeMobility"
      eventMobility:
        $ref: "#/definitions/EventMobility"
      eventPoasInRange:
        $ref: "#/definitions/EventPoasInRange"
      eventOther:
@@ -869,10 +899,10 @@ definitions:
    description: "Event object"
    example:
      name: "name"
      type: "UE-MOBILITY"
      eventUeMobility:
        ue: "ue"
        dest: "dest"
      type: "MOBILITY"
      eventMobility:
        src: "ue1"
        dest: "poa2"
  EventNetworkCharacteristicsUpdate:
    type: "object"
    properties:
@@ -889,6 +919,13 @@ definitions:
        - "ZONE-INTER-EDGE"
        - "ZONE-INTER-FOG"
        - "ZONE-EDGE-FOG"
        - "EDGE"
        - "FOG"
        - "UE"
        - "DISTANT-CLOUD"
        - "UE-APP"
        - "EDGE-APP"
        - "CLOUD-APP"
      latency:
        type: "integer"
        description: "Latency in ms"
@@ -904,19 +941,19 @@ definitions:
        description: "Packet loss percentage"
    description: "Network Characteristics update Event object"
    example: {}
  EventUeMobility:
  EventMobility:
    type: "object"
    properties:
      ue:
      src:
        type: "string"
        description: "UE identifier"
        description: "Source element identifier"
      dest:
        type: "string"
        description: "Destination identifier"
    description: "UE Mobility Event object"
        description: "Destination element identifier"
    description: "Mobility Event object"
    example:
      ue: "ue"
      dest: "dest"
      src: "ue1"
      dest: "poa2"
  EventPoasInRange:
    type: "object"
    properties:
+62 −21
Original line number Diff line number Diff line
@@ -771,6 +771,31 @@ func sendEventNetworkCharacteristics(event Event) (string, int) {
					break

				}
				// Parse Physical Locations
				for plIndex, pl := range nl.PhysicalLocations {
					if (elementType == "DISTANT CLOUD" || elementType == "EDGE" || elementType == "FOG" || elementType == "UE") && elementName == pl.Name {
						netloc := &scenario.Deployment.Domains[dIndex].Zones[zIndex].NetworkLocations[nlIndex].PhysicalLocations[plIndex]
						netloc.LinkLatency = netChar.Latency
						netloc.LinkLatencyVariation = netChar.LatencyVariation
						netloc.LinkThroughput = netChar.Throughput
						netloc.LinkPacketLoss = netChar.PacketLoss
						elementFound = true
						break
					}
					// Parse Processes
					for procIndex, proc := range pl.Processes {
						if (elementType == "CLOUD APPLICATION" || elementType == "EDGE APPLICATION" || elementType == "UE APPLICATION") && elementName == proc.Name {
							netloc := &scenario.Deployment.Domains[dIndex].Zones[zIndex].NetworkLocations[nlIndex].PhysicalLocations[plIndex].Processes[procIndex]
							netloc.AppLatency = netChar.Latency
							netloc.AppLatencyVariation = netChar.LatencyVariation
							netloc.AppThroughput = netChar.Throughput
							netloc.AppPacketLoss = netChar.PacketLoss
							elementFound = true
							break
						}
					}
				}

			}
		}
	}
@@ -795,7 +820,7 @@ func sendEventNetworkCharacteristics(event Event) (string, int) {
	return "", -1
}

func sendEventUeMobility(event Event) (string, int) {
func sendEventMobility(event Event) (string, int) {

	// Retrieve active scenario
	var scenario Scenario
@@ -805,16 +830,16 @@ func sendEventUeMobility(event Event) (string, int) {
	}

	// Retrieve UE name and destination PoA name
	ueName := event.EventUeMobility.Ue
	poaName := event.EventUeMobility.Dest
	plName := event.EventMobility.Src
	destName := event.EventMobility.Dest

	var oldNL *NetworkLocation
	var newNL *NetworkLocation
	var ue *PhysicalLocation
	var ueIndex int
	var pl *PhysicalLocation
	var plIndex int

	// Find UE & destination PoA
	log.Debug("Searching for UE and destination PoA in active scenario")
	// Find PL & destination element
	log.Debug("Searching for PL ", plName, " and destination in active scenario")
	for i := range scenario.Deployment.Domains {
		domain := &scenario.Deployment.Domains[i]

@@ -825,33 +850,40 @@ func sendEventUeMobility(event Event) (string, int) {
				nl := &zone.NetworkLocations[k]

				// Destination PoA
				if nl.Name == poaName {
				if nl.Name == destName {
					newNL = nl
				}
				//all edges are under a "default" network location element
				if zone.Name == destName && nl.Type_ == "DEFAULT" {
					newNL = nl
				}

				for l := range nl.PhysicalLocations {
					pl := &nl.PhysicalLocations[l]
					currentPl := &nl.PhysicalLocations[l]

					// UE to move
					if pl.Type_ == "UE" && pl.Name == ueName {
					if currentPl.Name == plName {
						if currentPl.Type_ == "UE" || currentPl.Type_ == "FOG" || currentPl.Type_ == "EDGE" {
							oldNL = nl
						ue = pl
						ueIndex = l
							pl = currentPl
							plIndex = l
						}

					}
				}
			}
		}
	}

	// Update UE location if necessary
	if ue != nil && oldNL != nil && newNL != nil && oldNL != newNL {
		log.Debug("Found UE and destination PoA. Updating UE location.")
	// Update PL location if necessary
	if pl != nil && oldNL != nil && newNL != nil && oldNL != newNL {
		log.Debug("Found PL and its destination. Updating PL location.")

		// Add UE to new location
		newNL.PhysicalLocations = append(newNL.PhysicalLocations, *ue)
		// Add PL to new location
		newNL.PhysicalLocations = append(newNL.PhysicalLocations, *pl)

		// Remove UE from old location
		oldNL.PhysicalLocations[ueIndex] = oldNL.PhysicalLocations[len(oldNL.PhysicalLocations)-1]
		oldNL.PhysicalLocations[plIndex] = oldNL.PhysicalLocations[len(oldNL.PhysicalLocations)-1]
		oldNL.PhysicalLocations = oldNL.PhysicalLocations[:len(oldNL.PhysicalLocations)-1]

		// Store updated active scenario in DB
@@ -869,6 +901,15 @@ func sendEventUeMobility(event Event) (string, int) {
			"meep.log.dest":      ue.Name,
		}).Info("Measurements log")

		log.WithFields(log.Fields{
			"meep.log.component": "ctrl-engine",
			"meep.log.msgType":   "mobilityEvent",
			"meep.log.oldPoa":    oldNL.Name,
			"meep.log.newPoa":    newNL.Name,
			"meep.log.src":       plName,
			"meep.log.dest":      plName,
		}).Info("Measurements log")

		// TODO in Execution Engine:
		//    - Update any deployed location services
		//    - Inform monitoring engine?
@@ -991,8 +1032,8 @@ func ceSendEvent(w http.ResponseWriter, r *http.Request) {
	var httpStatus int
	var error string
	switch eventType {
	case "UE-MOBILITY":
		error, httpStatus = sendEventUeMobility(event)
	case "MOBILITY":
		error, httpStatus = sendEventMobility(event)
	case "NETWORK-CHARACTERISTICS-UPDATE":
		error, httpStatus = sendEventNetworkCharacteristics(event)
	case "POAS-IN-RANGE":
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ type Event struct {

	EventNetworkCharacteristicsUpdate *EventNetworkCharacteristicsUpdate `json:"eventNetworkCharacteristicsUpdate,omitempty"`

	EventUeMobility *EventUeMobility `json:"eventUeMobility,omitempty"`
	EventMobility *EventMobility `json:"eventMobility,omitempty"`

	EventPoasInRange *EventPoasInRange `json:"eventPoasInRange,omitempty"`

+5 −5
Original line number Diff line number Diff line
@@ -9,12 +9,12 @@

package server

// UE Mobility Event object
type EventUeMobility struct {
// Mobility Event object
type EventMobility struct {

	// UE identifier
	Ue string `json:"ue,omitempty"`
	// Source element identifier
	Src string `json:"src,omitempty"`

	// Destination identifier
	// Destination element identifier
	Dest string `json:"dest,omitempty"`
}
+12 −0
Original line number Diff line number Diff line
@@ -33,4 +33,16 @@ type PhysicalLocation struct {
	UserMeta map[string]string `json:"userMeta,omitempty"`

	Processes []Process `json:"processes,omitempty"`

	// Latency in ms between the physical location and the network (wired interface, air interface)
	LinkLatency int32 `json:"linkLatency,omitempty"`

	// Latency variation in ms between the physical location and the network (wired interface, air interface)
	LinkLatencyVariation int32 `json:"linkLatencyVariation,omitempty"`

	// The limit of the traffic supported between the physical location and the network (wired interface, air interface)
	LinkThroughput int32 `json:"linkThroughput,omitempty"`

	// Packet lost (in terms of percentage) between the physical location and the network (wired interface, air interface)
	LinkPacketLoss float64 `json:"linkPacketLoss,omitempty"`
}
Loading