Tenant Network create Notification.

        Restart is not supported currently for this. fixme(padkrish).
513653
def network_create_notif(self, tenant_id, tenant_name, cidr):
        
        router_id = self.get_router_id(tenant_id, tenant_name)
        if not router_id:
            LOG.error("Rout ID not present for tenant")
            return False
        ret = self._program_dcnm_static_route(tenant_id, tenant_name)
        if not ret:
            LOG.error("Program DCNM with static routes failed "
                      "for router %s", router_id)
            return False

        # Program router namespace to have this network to be routed
        # to IN service network
        in_ip_dict = self.get_in_ip_addr(tenant_id)
        in_gw = in_ip_dict.get('gateway')
        if in_gw is None:
            LOG.error("No FW service GW present")
            return False
        ret = self.os_helper.program_rtr_nwk_next_hop(router_id, in_gw, cidr)
        if not ret:
            LOG.error("Unable to program default router next hop %s",
                      router_id)
            return False
        return True
619134
def create_alarm(self, check, notification_plan, criteria=None,
            disabled=False, label=None, name=None, metadata=None):
        
        return self._alarm_manager.create(check, notification_plan,
                criteria=criteria, disabled=disabled, label=label, name=name,
                metadata=metadata)
531911
def insertAnnouncement(self, announcement):
        
        url = announcement.get('url', None)
        try:
            peers.Peer(url)
        except:
            raise exceptions.BadUrlException(url)
        try:
            # TODO get more details about the user agent
            models.Announcement.create(
                url=announcement.get('url'),
                attributes=json.dumps(announcement.get('attributes', {})),
                remote_addr=announcement.get('remote_addr', None),
                user_agent=announcement.get('user_agent', None))
        except Exception as e:
            raise exceptions.RepoManagerException(e)
733522
@Override
    public void notificationCreated(RuntimeUpdateManager updateManager, RuntimeUpdateNotification notification) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(this, tc, "GPCL: RuntimeUpdate notification " + notification.getName() + ", apps in service = " + appsInService);

        if (this.appsInService > 0 && notification.getName().equals(RuntimeUpdateNotification.CONFIG_UPDATES_DELIVERED)) {
            setFutureGeneratePluginTask();
            notification.onCompletion(new ConfigUpdateListener());
        }
    }
542100
def _add_notification(self, message):
        
        sess = cherrypy.session
        username = sess.get(SESSION_KEY, None)
        if username not in self.notifications:
            self.notifications[username] = []
        self.notifications[username].append(message)
152843
public void notifyStart(String projectApiId, String projectVersion, String category) {
		try {
			if (isStarted()) {
				JSONObject startNotification = new JSONObject().
					put("project", new JSONObject().
						put("apiId", projectApiId).
						put("version", projectVersion)
					).
					put("category", category);
				
				socket.emit("run:start", startNotification);
			}
			else {
				LOGGER.log(Level.WARNING, "Probe Dock RT is not available to send the start notification");
			}
		}
		catch (Exception e) {
			LOGGER.log(Level.INFO, "Unable to send the start notification to the agent. Cause: " + e.getMessage());
			
			if (LOGGER.getLevel() == Level.FINEST) {
				LOGGER.log(Level.FINEST, "Exception: ", e);
			}
		}
	}
274576
def add_notification(self, notification):
        
        if notification.uuid in self.actions:
            logger.warning("Already existing notification: %s", notification)
            return

        logger.debug("Adding a notification: %s", notification)
        self.actions[notification.uuid] = notification
        self.nb_notifications += 1

        # A notification which is not a master one asks for a brok
        if notification.contact is not None:
            self.add(notification.get_initial_status_brok())
1179889
@Trivial  //trace is manually added.
    @Override
    public void notificationCreated(RuntimeUpdateManager updateManager, RuntimeUpdateNotification notification) {
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        if (trace && tc.isEntryEnabled())
            Tr.entry(this, tc, "notificationCreated", notification.getName());
            
        if (configChecked) {
            if (trace && tc.isEntryEnabled())
                Tr.exit(this, tc, "notificationCreated: early return.", notification.getName());
            return;
        }

        if (!configChecked && RuntimeUpdateNotification.APPLICATIONS_STARTING.equals(notification.getName())) {
            configChecked = true;
            
            try {
                String sessionCacheConfigFilter = FilterUtils.createPropertyFilter(Constants.SERVICE_PID, "com.ibm.ws.session.cache");

                Configuration[] sessionCacheConfigurations = configAdmin.listConfigurations(sessionCacheConfigFilter);
                
                if (sessionCacheConfigurations.length != 1) {
                    if (trace && tc.isDebugEnabled())
                        Tr.debug(this, tc, "There should always be one exactly one sessionCacheConfiguration. "
                                        + "Number of sessionCacheConfigurations found = " + sessionCacheConfigurations.length);
                }
                
                if (sessionCacheConfigurations != null) {
                    for (Configuration configuration : sessionCacheConfigurations) {
                        if (configuration == null) {
                            continue;
                        }

                        Dictionary<String, Object> props = configuration.getProperties();
                        String[] libraryRefs = (String[]) props.get("libraryRef");

                        if (libraryRefs == null) {               
                            if (!isSessionCacheBellConfigured()) {
                                Tr.error(tc, "ERROR_CONFIG_INVALID_HTTPSESSIONCACHE", Tr.formatMessage(tc, "SESSION_CACHE_CONFIG_MESSAGE", sampleConfig));
                            }
                        } else if (libraryRefs.length == 0) {
                            Tr.debug(tc, "The libraryRef attribute of the httpSessionCache in the server configuration could not be resolved. "
                                            + "Check for possible CWWKG0033W messages.");
                        } else {
                            //verify that the libraryRef points to a valid library configuration object.
                            Configuration libraryConfiguration = configAdmin.getConfiguration(libraryRefs[0]);
                            if(libraryConfiguration != null) {
                                //We found nothing wrong with the configuration.
                                if (trace && tc.isDebugEnabled())
                                    Tr.debug(this, tc, "A httpSessionCache configuration with a valid libraryRef was found.");
                            } else {
                                //This case should not be possible. 
                                //If the libraryRef is missing then libraryRefs is null.
                                //If the libraryRef points to an invalid library, libraryRefs length is 0.
                                //If there is more than one libraryRef, a CWWKG0014E error will have already been thrown.
                                if (trace && tc.isDebugEnabled())
                                    Tr.debug(this, tc, "A httpSessionCache configuration with a valid libraryRef was found, "
                                                    + "but the configuration the libraryRef points to is null. "
                                                    + "This should never happen.");
                            }
                        }
                    }
                }
            } catch ( InvalidSyntaxException | IOException ex) {
                //Something unexpected happened, log the exception as an error.
                Tr.error(tc, "ERROR_SESSION_INIT", ex);
            }
        }
        
        if (trace && tc.isEntryEnabled())
            Tr.exit(this, tc, "notificationCreated", notification.getName());
    }
788286
def create_tenant(self, tenant_id):
        """"""
        t_res = MechResource(tenant_id, a_const.TENANT_RESOURCE,
                             a_const.CREATE)
        self.provision_queue.put(t_res)
610852
def create_alarm(deployment_id, metric_name, data, api_key=None, profile="telemetry"):
    '''
    

    '''

    auth = _auth(api_key, profile)
    request_uri = _get_telemetry_base(profile) + "/alerts"

    key = "telemetry.{0}.alerts".format(deployment_id)

    # set the notification channels if not already set
    post_body = {
        "deployment": deployment_id,
        "filter": data.get('filter'),
        "notificationChannel": get_notification_channel_id(data.get('escalate_to')).split(),
        "condition": {
            "metric": metric_name,
            "max": data.get('max'),
            "min": data.get('min')
        }
    }

    try:
        response = requests.post(request_uri, data=salt.utils.json.dumps(post_body), headers=auth)
    except requests.exceptions.RequestException as e:
        # TODO: May be we should retry?
        log.error(six.text_type(e))

    if response.status_code >= 200 and response.status_code < 300:
        # update cache
        log.info('Created alarm on metric: %s in deployment: %s', metric_name, deployment_id)
        log.debug('Updating cache for metric %s in deployment %s: %s',
                  metric_name, deployment_id, response.json())
        _update_cache(deployment_id, metric_name, response.json())
    else:
        log.error(
            'Failed to create alarm on metric: %s in '
            'deployment %s: payload: %s',
            metric_name, deployment_id, salt.utils.json.dumps(post_body)
        )

    return response.status_code >= 200 and response.status_code < 300, response.json()
635179
def do_notification_update(mc, args):
    ''''''
    fields = {}
    fields['notification_id'] = args.id
    fields['name'] = args.name

    fields['type'] = args.type
    fields['address'] = args.address
    if not _validate_notification_period(args.period, args.type.upper()):
        return
    fields['period'] = args.period
    try:
        notification = mc.notifications.update(**fields)
    except (osc_exc.ClientException, k_exc.HttpError) as he:
        raise osc_exc.CommandError('%s\n%s' % (he.message, he.details))
    else:
        print(jsonutils.dumps(notification, indent=2))
1241987
public void startMonitoringNetworkChanges() {
        if (networkReceiver != null) {
            IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
            context.registerReceiver(networkReceiver, filter);
        } else {
            logger.warn("Cannot monitor device network changes. Make sure that a NetworkConnectionListener was passed to the NetworkMonitor constructor.");
        }
    }
442509
public void createTenant(String tenantId) {
        TenantBean tenant = new TenantBean(tenantId);
        try {
            URL endpoint = serverUrl.toURI().resolve("tenants").toURL(); //$NON-NLS-1$
            Request request = new Request.Builder()
                    .url(endpoint)
                    .post(toBody(tenant))
                    .header("Hawkular-Tenant", tenantId) //$NON-NLS-1$
                    .build();
            Response response = httpClient.newCall(request).execute();
            if (response.code() >= 400) {
                throw hawkularMetricsError(response);
            }
        } catch (URISyntaxException | IOException e) {
            throw new RuntimeException(e);
        }
    }
486436
public NotificationArea createNotificationArea(RESTRequest request, String basePath, NotificationSettings notificationSettings) {
        //Cleanup old clients
        cleanUp(request);

        //Fetch a new ID
        int clientID = getNewClientID();

        //Make the new inbox and insert into map
        ClientNotificationArea newInbox = new ClientNotificationArea(notificationSettings.deliveryInterval, notificationSettings.inboxExpiry, clientID);

        //Don't need to use "putIfAbsent" here because the key is guaranteed to be unique
        inboxes.put(clientID, newInbox);

        //Create the notification area to be returned to the client
        NotificationArea newArea = new NotificationArea();
        newArea.clientURL = basePath + clientID;
        newArea.inboxURL = newArea.clientURL + "/inbox";
        newArea.registrationsURL = newArea.clientURL + "/registrations";
        newArea.serverRegistrationsURL = newArea.clientURL + "/serverRegistrations";

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Created notification area for client ID " + clientID);
        }

        return newArea;
    }
1263947
def create(notification_options)
      response = @connection.post PARCELNOTIFICATION_URL, body: notification_options.to_json.to_ascii, headers: { 'Content-Type' => 'application/json' }
      RecursiveOpenStruct.new(response.parsed, recurse_over_arrays: true)
    end
15245
def notify(*options, &block)
      raise "Couldn't create notifications without a block" unless block_given?

      conditions = *options
      conditions = DEFAULT_NOTIFICATIONS if options.empty?

      conditions.each do |condition|
        notification = Notification.new(condition)
        notification.instance_eval(&block)

        @notifications[condition] = notification
      end
    end
990223
def project_delete_notif(self, tenant_id, tenant_name):
        
        if not self.fw_init:
            return
        rtr_name = '_'.join([fw_constants.TENANT_EDGE_RTR, tenant_name])
        self.os_helper.delete_router_by_name(rtr_name, tenant_id)