Commit bdf998e9 authored by Kevin Di Lallo's avatar Kevin Di Lallo Committed by GitHub Enterprise
Browse files

Merge pull request #37 from wbu-tep/kd_sp47_dev_apps

MEC Service Management fixes
parents 3f2d9fce 65094f19
Loading
Loading
Loading
Loading
+46 −6
Original line number Diff line number Diff line
version: 1.8.1
version: 1.8.2
repo:
  name: AdvantEDGE

@@ -905,6 +905,21 @@ repo:

    # Go Packages
    go-packages:
      meep-ams-client:
        # location of source code
        src: go-packages/meep-ams-client
        # supports linting
        lint: false
      meep-app-support-client:
        # location of source code
        src: go-packages/meep-app-support-client
        # supports linting
        lint: false
      meep-applications:
        # location of source code
        src: go-packages/meep-applications
        # supports linting
        lint: true
      meep-couch:
        # location of source code
        src: go-packages/meep-couch
@@ -930,6 +945,11 @@ repo:
        src: go-packages/meep-gis-cache
        # supports linting
        lint: true
      meep-gis-engine-client:
        # location of source code
        src: go-packages/meep-gis-engine-client
        # supports linting
        lint: false
      meep-http-logger:
        # location of source code
        src: go-packages/meep-http-logger
@@ -985,6 +1005,11 @@ repo:
        src: go-packages/meep-net-char-mgr
        # supports linting
        lint: true
      meep-pdu-session-store:
        # location of source code
        src: go-packages/meep-pdu-session-store
        # supports linting
        lint: true
      meep-redis:
        # location of source code
        src: go-packages/meep-redis
@@ -1010,6 +1035,11 @@ repo:
        src: go-packages/meep-sandbox-store
        # supports linting
        lint: true
      meep-service-mgmt-client:
        # location of source code
        src: go-packages/meep-service-mgmt-client
        # supports linting
        lint: false
      meep-sessions:
        # location of source code
        src: go-packages/meep-sessions
@@ -1020,6 +1050,11 @@ repo:
        src: go-packages/meep-subscriptions
        # supports linting
        lint: true
      meep-swagger-api-mgr:
        # location of source code
        src: go-packages/meep-swagger-api-mgr
        # supports linting
        lint: true
      meep-users:
        # location of source code
        src: go-packages/meep-users
@@ -1030,11 +1065,6 @@ repo:
        src: go-packages/meep-wais-client
        # supports linting
        lint: false
      meep-ams-client:
        # location of source code
        src: go-packages/meep-ams-client
        # supports linting
        lint: false
      meep-watchdog:
        # location of source code
        src: go-packages/meep-watchdog
@@ -1048,6 +1078,16 @@ repo:

    # Javascript Packages
    js-packages:
      meep-auth-svc-client:
        # location of source code
        src: js-packages/meep-auth-svc-client
        # supports linting
        lint: false
      meep-gis-engine-client:
        # location of source code
        src: js-packages/meep-gis-engine-client
        # supports linting
        lint: false
      meep-metrics-engine-client:
        # location of source code
        src: js-packages/meep-metrics-engine-client
+7 −0
Original line number Diff line number Diff line
@@ -853,6 +853,13 @@ services:
        path: '/events/{type}'
        method: 'POST'
        mode: 'allow'
      - name: 'ServicesGET'
        path: '/services'
        method: 'GET'
        mode: 'verify'
        roles:
          admin: 'allow'
          user: 'allow'
  #------------------------------
  #  WAI Service (Sbox)
  #------------------------------
+92 −15
Original line number Diff line number Diff line
@@ -98,7 +98,8 @@ import {
  sboxChangeMapPoaList,
  sboxChangeMapComputeList,
  sboxChangeApiTable,
  sboxChangeAppInstanceTable
  sboxChangeAppInstanceTable,
  sboxChangeSvcTable
} from '../state/sbox';

const SBOX_ERR_COUNT_MAX = 5;
@@ -160,7 +161,8 @@ class AppContainer extends Component {
    this.meepSandboxControlApi = new meepPlatformCtrlRestApiClient.SandboxControlApi();
    this.meepActiveScenarioApi = new meepSandboxCtrlRestApiClient.ActiveScenarioApi();
    this.meepEventsApi = new meepSandboxCtrlRestApiClient.EventsApi();
    this.meepAppInfoApi = new meepSandboxCtrlRestApiClient.ApplicationsApi();
    this.meepApplicationsApi = new meepSandboxCtrlRestApiClient.ApplicationsApi();
    this.meepServicesApi = new meepSandboxCtrlRestApiClient.ServicesApi();
    this.meepMetricsEngineApi = new meepMetricsEngineRestApiClient.MetricsApi();
    this.meepGisAutomationApi = new meepGisEngineRestApiClient.AutomationApi();
    this.meepGeoDataApi = new meepGisEngineRestApiClient.GeospatialDataApi();
@@ -255,6 +257,11 @@ class AppContainer extends Component {
    if (this.props.sandboxName !== prevProps.sandboxName) {
      this.setBasePaths();
    }

    // Trigger API console refresh when switching back to sandbox page
    if (this.props.page === PAGE_SANDBOX && prevProps.page !== PAGE_SANDBOX) {
      this.refreshApiConsole = true;
    }
  }

  // Timers
@@ -301,6 +308,7 @@ class AppContainer extends Component {
                this.refreshAutomation();
                this.refreshMetricsTable();
                this.refreshAppInstancesTable();
                this.refreshServices();
              }
            }
          }
@@ -496,7 +504,7 @@ class AppContainer extends Component {
  deleteAppInstances() {
    var appInstances = this.props.appInstancesSelected;
    for (var i = 0; i < appInstances.length; i++) {
      this.meepAppInfoApi.applicationsAppInstanceIdDELETE(appInstances[i], null);
      this.meepApplicationsApi.applicationsAppInstanceIdDELETE(appInstances[i], null);
    }
    this.props.changeAppInstancesSelected([]);
  }
@@ -504,11 +512,11 @@ class AppContainer extends Component {
  createAppInstance(param) {
    var formParams = {
      'name': param.appName,
      'mepName': param.mepName,
      'nodeName': param.mepName,
      'type': 'USER',
      'state': 'INITIALIZED'
      'persist': false
    };
    this.meepAppInfoApi.applicationsPOST(formParams, (error, data, response) => {
    this.meepApplicationsApi.applicationsPOST(formParams, (error, data, response) => {
      this.createAppInstanceCb(error, data, response);
    });
    this.props.changeCurrentDialog(null);
@@ -713,6 +721,7 @@ class AppContainer extends Component {
        this.props.changeApiTable(null);
        this.props.changeApiDetailedData(null);
        this.props.changeAppInstanceTable([]);
        this.props.changeSvcTable([]);
      }
      return;
    }
@@ -948,6 +957,41 @@ class AppContainer extends Component {
    });
  }

  /**
   * Callback function to receive the result of the servicesGET operation.
   * @callback module:api/ServicesApi~servicesGETCallback
   * @param {String} error Error message, if any.
   * @param {Array.<module:model/ServiceInfo>} data The data returned by the service call.
   * @param {String} response The complete HTTP response.
   */
  getServicesCb(error, data) {
    if (error !== null) {
      this.props.changeSvcTable([]);
      return;
    }

    // Make sure are ready to update state
    if (this.props.updateAppInstancesInProgressCount !== -1) {
      return;
    }

    // Update App Instance table only if data is different 
    var services = data ? data : [];
    const isArrayEqual = (x, y) => _.isEmpty(_.xorWith(x, y, _.isEqual));
    if (!isArrayEqual(this.props.svcTable,services)) {
      this.props.changeSvcTable(services);

      // Update Edge App states
      this.refreshEdgeApps(this.props.appInstanceTable, services);
    }
  }

  refreshServices() {
    this.meepServicesApi.servicesGET(null, (error, data, response) => {
      this.getServicesCb(error, data, response);
    });
  }

  /**
   * Callback function to receive the result of the postHttpQuery operation.
   * @callback module:api/AppsApi~applicationsGET
@@ -973,12 +1017,12 @@ class AppContainer extends Component {
      this.props.changeAppInstanceTable(appInstances);

      // Update Edge App states
      this.refreshEdgeApps(appInstances);
      this.refreshEdgeApps(appInstances, this.props.svcTable);
    }
  }

  refreshAppInstancesTable() {
    this.meepAppInfoApi.applicationsGET(null, (error, data, response) => {
    this.meepApplicationsApi.applicationsGET(null, (error, data, response) => {
      this.getAppInstancesCb(error, data, response);
    });
  }
@@ -995,7 +1039,19 @@ class AppContainer extends Component {
    return null;
  }

  refreshEdgeApps(appInstances) {
  getSvcInstance(appId, services) {
    if (services) {
      for (var i = 0; i < services.length; i++) {
        let service = services[i];
        if (service.appId === appId) {
          return service;
        }
      }
    }
    return null;
  }

  refreshEdgeApps(appInstances, services) {
    if (!this.props.edgeApps) {
      return;
    }
@@ -1017,16 +1073,26 @@ class AppContainer extends Component {

      // Find matching app instance, if any
      let appInstance = this.getAppInstance(edgeApp.id, appInstances);
      let svcInstance = this.getSvcInstance(edgeApp.id, services);

      // Update app instance ID when available
      if (appInstance && !edgeApp.appId) {
        edgeApp.appId = edgeApp.id;
        updateRequired = true;
      }

      // Update service state
      if (appInstance === null) {
      if (!appInstance || !svcInstance) {
        if (edgeApp.enabled) {
          edgeApp.enabled = false;
          edgeApp.appId = '';
          edgeApp.svcId = '';
          updateRequired = true;
        }
      } else {
        if (!edgeApp.enabled) {
          edgeApp.instance = appInstance.name;
          edgeApp.svcId = svcInstance.id;
          edgeApp.enabled = true;
          updateRequired = true;
        }
@@ -1042,7 +1108,7 @@ class AppContainer extends Component {
    }
  }

  decrementEdgeApps(appInstances) {
  decrementEdgeApps(appInstances, services) {
    if (!this.props.edgeApps) {
      return;
    }
@@ -1068,8 +1134,14 @@ class AppContainer extends Component {
        // Enable controls immediately after operation is complete
        if (edgeApp.enableInProgressCount < (EDGE_APP_ENABLE_COUNT_MAX - BLACKOUT_TIME)) {
          let appInstance = this.getAppInstance(edgeApp.id, appInstances);
          if (appInstance !== null) {
          let svcInstance = this.getSvcInstance(edgeApp.id, services);
          if (appInstance && !edgeApp.appId) {
            edgeApp.appId = edgeApp.id;
          }
          if (appInstance && svcInstance) {
            edgeApp.instance = appInstance.name;
            edgeApp.appId = edgeApp.id;
            edgeApp.svcId = svcInstance.id;
            edgeApp.enabled = true;
            edgeApp.enableInProgressCount = -1;
          }
@@ -1080,8 +1152,11 @@ class AppContainer extends Component {
        // Enable controls immediately after operation is complete
        if (edgeApp.disableInProgressCount < (EDGE_APP_DISABLE_COUNT_MAX - BLACKOUT_TIME)) {
          let appInstance = this.getAppInstance(edgeApp.id, appInstances);
          if (appInstance === null) {
          let svcInstance = this.getSvcInstance(edgeApp.id, services);
          if (!appInstance || !svcInstance) {
            edgeApp.enabled = false;
            edgeApp.appId = '';
            edgeApp.svcId = '';
            edgeApp.disableInProgressCount = -1;
          }
        }
@@ -1114,7 +1189,7 @@ class AppContainer extends Component {
    }

    // Edge App counters
    this.decrementEdgeApps(this.props.appInstanceTable);
    this.decrementEdgeApps(this.props.appInstanceTable, this.props.svcTable);
  }

  renderPage() {
@@ -1135,7 +1210,7 @@ class AppContainer extends Component {
          eventsApi={this.meepEventsApi}
          metricsApi={this.meepMetricsEngineApi}
          automationApi={this.meepGisAutomationApi}
          applicationsApi={this.meepAppInfoApi}
          applicationsApi={this.meepApplicationsApi}
        />
      );

@@ -1284,6 +1359,7 @@ const mapStateToProps = state => {
    edgeApps: state.ui.edgeApps,
    appInstanceTable: state.sbox.appInstanceTable.data,
    appInstancesSelected: state.ui.appInstancesSelected,
    svcTable: state.sbox.svcTable.data,
    updateUeInProgressCount: state.ui.updateUeInProgressCount,
    updateAppInstancesInProgressCount: state.ui.updateAppInstancesInProgressCount,
    activationInProgressCount: state.ui.activationInProgressCount,
@@ -1327,6 +1403,7 @@ const mapDispatchToProps = dispatch => {
    changeMapComputeList: list => dispatch(sboxChangeMapComputeList(list)),
    changeApiTable: value => dispatch(sboxChangeApiTable(value)),
    changeAppInstanceTable: value => dispatch(sboxChangeAppInstanceTable(value)),
    changeSvcTable: value => dispatch(sboxChangeSvcTable(value)),
    changeUpdateUeInProgressCount: count => dispatch(uiSandboxChangeUpdateUeInProgressCount(count)),
    changeUpdateAutomationInProgressCount: count => dispatch(uiSandboxChangeUpdateAutomationInProgressCount(count)),
    changeUpdateAppInstancesInProgressCount: count => dispatch(uiSandboxChangeUpdateAppInstancesInProgressCount(count)),
+32 −11
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ class AppInstanceInfo extends Component {

    if (checked) {
      // Send event to enable service
      var sandboxEvent = {
      var enableEvent = {
        name: 'name',
        type: 'SCENARIO-UPDATE',
        eventScenarioUpdate: {
@@ -49,15 +49,33 @@ class AppInstanceInfo extends Component {
          }
        }
      };
      this.props.eventsApi.sendEvent('SCENARIO-UPDATE', sandboxEvent);
      this.props.eventsApi.sendEvent('SCENARIO-UPDATE', enableEvent);

      // Enable edge app & start timer to temporarily ignore backend
      edgeApp.enabled = true;
      edgeApp.enableInProgressCount = EDGE_APP_ENABLE_COUNT_MAX;

    } else {
      // Delete app instance
      this.props.applicationsApi.applicationsAppInstanceIdDELETE(edgeApp.id, null);
      // Send event to disable service
      var disableEvent = {
        name: 'name',
        type: 'SCENARIO-UPDATE',
        eventScenarioUpdate: {
          action: 'REMOVE',
          gracePeriod: 10,
          node: {
            type: 'EDGE-APP',
            parent: edgeApp.mepName,
            nodeDataUnion: {
              process: {
                id: edgeApp.id,
                name: edgeApp.name
              }
            }
          }
        }
      };
      this.props.eventsApi.sendEvent('SCENARIO-UPDATE', disableEvent);

      // Disable edge app & start timer to temporarily ignore backend 
      edgeApp.enabled = false;
@@ -94,7 +112,7 @@ class AppInstanceInfo extends Component {
      return (
        <>
          <div style={{ marginTop: 15 }}>
            <Typography theme="primary" use="body1">MEC service startup in progress...<br/>This operation may take a few seconds.</Typography>
            <Typography theme="primary" use="body1">MEC Service startup in progress...<br/>This operation may take a few seconds.</Typography>
          </div>
        </>
      );
@@ -104,7 +122,7 @@ class AppInstanceInfo extends Component {
      return (
        <>
          <div style={{ marginTop: 15 }}>
            <Typography theme="primary" use="body1">MEC service shutdown in progress...<br/>This operation may take a few seconds.</Typography>
            <Typography theme="primary" use="body1">MEC Service shutdown in progress...<br/>This operation may take a few seconds.</Typography>
          </div>
        </>
      );
@@ -114,7 +132,7 @@ class AppInstanceInfo extends Component {
      return (
        <>
          <div style={{ marginTop: 15 }}>
            <Typography theme="primary" use="body1">This MEC service is currently disabled.</Typography>
            <Typography theme="primary" use="body1">This MEC Service is currently disabled.</Typography>
          </div>
        </>
      );
@@ -131,19 +149,22 @@ class AppInstanceInfo extends Component {
    let isMec011 = edgeApp.pseudoName.includes('011');
    let disabled = (isMec011 || edgeApp.enableInProgressCount !== -1 || edgeApp.disableInProgressCount !== -1) ? true : false;
    let mepInfoStr = (isMec011) ? edgeApp.mepName + ' platform API' : edgeApp.instance + ' running on ' + edgeApp.mepName;
    let appInfoStr = 'appInstanceId: ' + edgeApp.id;
    let appInfoStr = 'appInstanceId: ' + ((edgeApp.appId) ? edgeApp.appId : 'unavailable');
    let svcInfoStr = 'serviceId: ' + ((edgeApp.svcId) ? edgeApp.svcId : 'unavailable');

    return (
      <>
        <Grid style={{ marginTop: 0}}>
          <GridCell title="Enable or disable the selected MEC API" span={12}>
            <p style={{ marginTop: 5, marginBottom: 10 }}>
              <Typography theme="primary" use="headline6">Application details</Typography>
              <Typography theme="primary" use="headline6">MEC Service details</Typography>
            </p>
            <Typography className="text-color-main" use="body1">
              {mepInfoStr}
              {!isMec011 && appInfoStr && <br/>}
              {!isMec011 && <br/>}
              {!isMec011 && appInfoStr}
              {!isMec011 && <br/>}
              {!isMec011 && svcInfoStr}
            </Typography>
          </GridCell>
        </Grid>
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ class AppInstanceTable extends Component {
                          />
                        </TableCell>
                        <TableCell className={classes.tableBodyCellNoWrap} scope="row">
                          {row.name} running on {row.mepName}<br/>
                          {row.name} running on {row.nodeName}<br/>
                          ID: {row.id}
                        </TableCell>
                      </TableRow>
Loading