Beispiel #1
0
triggers autoscale.

'''
import argparse
import logging
import json
from twisted.internet import reactor, task
from avi.infrastructure.avi_logging import get_root_logger, get_logger
from avi.sdk.avi_api import ApiSession
from avi.sdk.utils.api_utils import ApiUtils
from avi.sdk.samples.common import get_sample_ssl_params
import traceback
from datetime import datetime

log = get_root_logger(__name__, logfile_path='/opt/avi/log/sdkautoscale.log',
                      level=logging.DEBUG,
                      propagate=True)


class AnalyticsAutoScaler(object):
    '''
    Performs periodic autoscaling check based on the analytics.
    '''
    vs_name = ''
    api = None
    reactor = None
    AUTOSCALE_TIMEOUT = 5
    SE_CPU_METRIC = 'se_stats.avg_cpu_usage'
    LATENCY_METRIC = 'l7_client.avg_client_txn_latency'
    POOL_APDEX_METRIC = 'l4_server.apdexr'
    max_scaleout = 2
Beispiel #2
0
    customeruri         - Secitogo customer URI.
    certtype            - Optional - Certificate type. Default type 3.
    term                - Optional - Certificate term. Default 365.
    comments            - Comments for order.
    wait_timer          - Optional - Wait time between queries to get the generated certificate. Default to 15s
    tries               - Optional - Total number of tries to get certificate before fails. Default is 10
    client_certificate  - The client certificate exactly as it appears. Do not modify formatting
    client_key          - The client key exactly as it appears. Do not modify formatting
'''

import json, time, requests, os, re, logging, os, sys, subprocess
from requests.exceptions import HTTPError
from tempfile import NamedTemporaryFile
from avi.infrastructure.avi_logging import get_root_logger

log = get_root_logger(__name__, '/opt/avi/log/sectigo.log', logging.DEBUG)


class Pending(Exception):
    """Serve as a generic Exception indicating a certificate is in a pending state."""
    CODE = -183


def get_crt(csr, user, orgid, certtype, term, comments, customeruri, csrfile,
            client_crt, client_key, wait_timer, tries):

    # helper function - run external commands
    def _cmd(cmd_list,
             stdin=None,
             cmd_input=None,
             err_msg="Command Line Error"):
Beispiel #3
0
triggers autoscale.

'''
import argparse
import logging
import json
from twisted.internet import reactor, task
from avi.infrastructure.avi_logging import get_root_logger, get_logger
from avi.sdk.avi_api import ApiSession
from avi.sdk.utils.api_utils import ApiUtils
from avi.sdk.samples.common import get_sample_ssl_params
import traceback
from datetime import datetime

log = get_root_logger(__name__,
                      logfile_path='/opt/avi/log/sdkautoscale.log',
                      level=logging.DEBUG,
                      propagate=True)


class AnalyticsAutoScaler(object):
    '''
    Performs periodic autoscaling check based on the analytics.
    '''
    vs_name = ''
    api = None
    reactor = None
    AUTOSCALE_TIMEOUT = 5
    SE_CPU_METRIC = 'se_stats.avg_cpu_usage'
    LATENCY_METRIC = 'l7_client.avg_client_txn_latency'
    POOL_APDEX_METRIC = 'l4_server.apdexr'
    max_scaleout = 2
Beispiel #4
0
# tenant
# dryrun (True/False) If True, sends to the letsencrypt staging server and issues a fake certificate.
################
################

import os, subprocess, json, base64, binascii, time, hashlib, re, logging
from urllib.request import urlopen, Request  # Python 3
from tempfile import NamedTemporaryFile
from avi.infrastructure.avi_logging import get_root_logger
from avi.sdk.avi_api import ApiSession

DEFAULT_CA = "https://acme-v02.api.letsencrypt.org"  # DEPRECATED! USE DEFAULT_DIRECTORY_URL INSTEAD
DEFAULT_DIRECTORY_URL = "https://acme-v02.api.letsencrypt.org/directory"
DEFAULT_STAGING_DIRECTORY_URL = "https://acme-staging-v02.api.letsencrypt.org/directory"

log = get_root_logger(__name__, '/opt/avi/log/letsencrypt.log', logging.DEBUG)


def get_crt(user,
            password,
            tenant,
            api_version,
            account_key,
            csr,
            CA=DEFAULT_CA,
            disable_check=False,
            directory_url=DEFAULT_DIRECTORY_URL,
            contact=None):
    directory, acct_headers, alg, jwk = None, None, None, None  # global variables

    # helper functions - base64 encode for jose spec