Exemple #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'
Exemple #2
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.")