code: public void addScenario(Class<? extends Scenario> scenarioClass,
              String scenarioID, String initialState, Properties properties,
              String gatewayDeviceID, String externalLinkID)
              throws ShanksException {
          // throws NonGatewayDeviceException, TooManyConnectionException,
          // DuplicatedIDException, AlreadyConnectedScenarioException,
          // SecurityException, NoSuchMethodException, IllegalArgumentException,
          // InstantiationException, IllegalAccessException,
          // InvocationTargetException {
          Constructor<? extends Scenario> c;
          Scenario scenario;
          try {
              c = scenarioClass.getConstructor(new Class[] { String.class,
                      String.class, Properties.class, Logger.class });
              scenario = c.newInstance(scenarioID, initialState, properties, this.getLogger());
          } catch (SecurityException e) {
              throw new ShanksException(e);
          } catch (NoSuchMethodException e) {
              throw new ShanksException(e);
          } catch (IllegalArgumentException e) {
              throw new ShanksException(e);
          } catch (InstantiationException e) {
              throw new ShanksException(e);
          } catch (IllegalAccessException e) {
              throw new ShanksException(e);
          } catch (InvocationTargetException e) {
              throw new ShanksException(e);
          }
  
          Device gateway = (Device) scenario.getNetworkElement(gatewayDeviceID);
          Link externalLink = (Link) this.getNetworkElement(externalLinkID);
          if (!scenario.getCurrentElements().containsKey(gatewayDeviceID)) {
              throw new NonGatewayDeviceException(scenario, gateway, externalLink);
          } else {
              gateway.connectToLink(externalLink);
              if (!this.getCurrentElements().containsKey(externalLink.getID())) {
                  this.addNetworkElement(externalLink);
              }
              if (!this.scenarios.containsKey(scenario)) {
                  this.scenarios.put(scenario, new ArrayList<Link>());
              } else {
                  List<Link> externalLinks = this.scenarios.get(scenario);
                  if (!externalLinks.contains(externalLink)) {
                      externalLinks.add(externalLink);
                  } else if (externalLink.getLinkedDevices().contains(gateway)) {
                      throw new AlreadyConnectedScenarioException(scenario,
                              gateway, externalLink);
                  }
              }
          }
      }
docs: Add the scenario to the complex scenario.
  
  @param scenarioClass
  @param scenarioID
  @param initialState
  @param properties
  @param gatewayDeviceID
  @param externalLinkID
  @throws ShanksException