예제 #1
0
    def __init__(self, user):
        protocol_log.info('SSH Protocal Class inited.')
        self.user = user

        pkg_path = 'com' + os.path.sep + 'ericsson' + os.path.sep + 'xn' + os.path.sep + 'server' + os.path.sep + 'common'
        self.pardir = os.path.dirname(os.path.abspath(__file__)).split(pkg_path)[0]
        prop_file = self.pardir + 'config' + os.path.sep + str(sys.argv[2]).strip() + os.path.sep + str(
            sys.argv[2]).strip() + '.properties'
        protocol_log.info('Property file path: ' + prop_file)
        p = Properties(prop_file)
        self.prompt = p.getProperty('prompt')
        self.nodeType = str(sys.argv[1]).strip()

        self.addhelp = ""
        if (self.nodeType == 'ocgs'):
            self.addhelp = "x_view_conf\nx_modify_conf [-nodepara value] [-licid id] [-licpara value]\nocgslicaddone\nocgslicremoveone"
            self.nodexml = self.pardir + 'config' + os.path.sep + str(sys.argv[2]).strip() + os.path.sep + str(
                sys.argv[2]).strip() + '_node.xml'
            if (not os.path.isfile(self.nodexml)):
                protocol_log.error('The node XML configuration file does not exist! XML Path: ' + self.nodexml)
                raise StandardError('Unable to find the NODE XML Configuration file.')
        elif ('sbc' == self.nodeType):
            # Init the counter simulator
            self.sbcPMHolder = globalarguments.SBC_PM_Holder
            self.sbcmode = 0
            self.sbcprops = p
            self.xmlPath = self.pardir + 'config' + os.path.sep + str(sys.argv[2]).strip() + os.path.sep + str(
                sys.argv[2]).strip() + '_node.xml'
            self.logPath = self.pardir + 'config' + os.path.sep + str(sys.argv[2]).strip() + os.path.sep + str(
                sys.argv[2]).strip() + '_log.now'
예제 #2
0
    def __init__(self, user):
        protocol_log.info('SSH Protocal Class inited.')
        self.user = user
        sep = os.path.sep

        pkg_path = 'com' + os.path.sep + 'ericsson' + os.path.sep + 'xn' + os.path.sep + 'server' + os.path.sep + 'common'
        self.pardir = os.path.dirname(os.path.abspath(__file__)).split(pkg_path)[0]
        prop_file = self.pardir + 'config' + os.path.sep + 'ssh_daemon' + os.path.sep + str(sys.argv[2]).strip() + \
                    os.path.sep + str(sys.argv[2]).strip() + '.properties'
        protocol_log.info('Property file path: ' + prop_file)
        p = Properties(prop_file)
        self.prompt = p.getProperty('prompt')
        self.nodeType = str(sys.argv[1]).strip()

        self.addhelp = ""
        if self.nodeType == 'ocgas':
            self.addhelp = "x_view_conf\nx_modify_conf [-nodepara value] [-licid id] [-licpara value]\no" \
                           "cgaslicaddone\nocgaslicremoveone\n/xcom/agent/update_alarmlevel.sh"
            self.xml_path = self.pardir + 'config' + os.path.sep + 'ssh_daemon' + os.path.sep + \
                           str(sys.argv[2]).strip() + os.path.sep + str(sys.argv[2]).strip() + '_node.xml'
            if not os.path.isfile(self.xml_path):
                protocol_log.error('The node XML configuration file does not exist! XML Path: ' + self.xml_path)
                raise StandardError('Unable to find the NODE XML Configuration file.')
        elif 'sbc' == self.nodeType:
            # Init the counter simulator
            self.sbcPMHolder = globalarguments.SBC_PM_Holder
            self.sbcmode = 0
            self.sbcprops = p
            self.xmlPath = self.pardir + 'config' + os.path.sep + 'ssh_daemon' + os.path.sep + \
                           str(sys.argv[2]).strip() + os.path.sep + str(sys.argv[2]).strip() + '_node.xml'
            self.logPath = self.pardir + 'config' + os.path.sep + 'ssh_daemon' + os.path.sep + \
                           str(sys.argv[2]).strip() + os.path.sep + str(sys.argv[2]).strip() + '_log.now'
            self.addhelp = ['tcp_channel', 'li_activate', 'li_deactivate', 'pm_update', 'get_stat',
                            'get_config', 'get_appl_trace']
        elif 'sgsnmme' == self.nodeType:
            self.xml_path = self.pardir + 'config' + os.path.sep + 'ssh_daemon' + os.path.sep + \
                            str(sys.argv[2]).strip() + os.path.sep + str(sys.argv[2]).strip() + '_node.xml'
            self.logger = protocol_log
            self.addhelp = SgsnmmeCmdHandler(protocol_log, self.xml_path, '').get_help_cmds()
        elif 'gmlc' == self.nodeType:
            self.xml_path = self.pardir + 'config' + os.path.sep + 'ssh_daemon' + os.path.sep + \
                            str(sys.argv[2]).strip() + os.path.sep + str(sys.argv[2]).strip() + '_node.xml'
            self.logger = protocol_log
            self.addhelp = GmlcHandler(self.xml_path, '').help_msg()
        elif 'epg' == self.nodeType:
            self.xml_path = self.pardir + 'config' + os.path.sep + 'ssh_daemon' + os.path.sep + \
                            str(sys.argv[2]).strip() + os.path.sep + str(sys.argv[2]).strip() + '_node.xml'
            self.logger = protocol_log
            self.addhelp = EpgHandler(self.xml_path).get_cmd_msg()
            self.cmd_mode = -1
예제 #3
0
publicKey = 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAGEArzJx8OYOnJmzf4tfBEvLi8DVPrJ3/c9k2I/Az64fxjHf9imyRJbixtQhlH9lfNjUIx+4LmrJH5QNRsFporcHDKOTwTTYLh5KmRpslkYHRivcJSkbh/C+BR3utDS555mV'

if __name__ == '__main__':
    try:
        if len(sys.argv) < 3:
            server_log.critical('Please feed the node type and node configuration name as parameter.')
        else:
            cfg_path = pardir + os.path.sep + 'config' + os.path.sep + str(sys.argv[2]).strip()
            if (not os.path.isdir(cfg_path) or not os.path.isfile(
                                cfg_path + os.path.sep + str(sys.argv[2]).strip() + ".properties")):
                server_log.error('The configuration file that you have specified does not exist!')
            else:
                cfg_file = os.path.normpath(cfg_path + os.path.sep + str(sys.argv[2]).strip() + ".properties")
                server_log.info('Get properties from the configuration file: ' + cfg_file + '. ')
                p = Properties(cfg_file)

                # username = p.getProperty('username')
                # password = p.getProperty('password')

                host = p.getProperty('host')
                portno = p.getProperty('port')

                # if(username is None or password is None or host is None or portno is None):
                # server_log.error('The configuration file: ' + cfg_file + " need to provide username, password, host
                # and port information.")

                if host is None or portno is None:
                    server_log.error(
                        'The configuration file: ' + cfg_file + " need to provide host and port information.")
                else:
예제 #4
0
                sys.argv[2]).strip()
            if (not os.path.isdir(cfg_path)
                    or not os.path.isfile(cfg_path + os.path.sep +
                                          str(sys.argv[2]).strip() +
                                          ".properties")):
                server_log.error(
                    'The configuration file that you have specified does not exist!'
                )
            else:
                cfg_file = os.path.normpath(cfg_path + os.path.sep +
                                            str(sys.argv[2]).strip() +
                                            ".properties")
                server_log.info(
                    'Get properties from the configuration file: ' + cfg_file +
                    '. ')
                p = Properties(cfg_file)

                # username = p.getProperty('username')
                # password = p.getProperty('password')

                host = p.getProperty('host')
                portno = p.getProperty('port')

                # if(username is None or password is None or host is None or portno is None):
                # server_log.error('The configuration file: ' + cfg_file + " need to provide username, password, host
                # and port information.")

                if host is None or portno is None:
                    server_log.error(
                        'The configuration file: ' + cfg_file +
                        " need to provide host and port information.")