예제 #1
0
    def setup(self, model):
        self.model = model

        self.category = "cps_api_obj_CAT_" + to_string(model.module.name())
        self.init_names()
        hist_file_name = self.get_yang_history_file_name(model.module.model_name())

        self.history = object_history.init(
            self.context,
            hist_file_name,
            self.category)
예제 #2
0
            stdout=subprocess.PIPE)
        of = open(yin_file, "w")
        stdout, stderr = p.communicate()
        for out in stdout:
            of.write(out)
        of.close()
        p.wait()

        old_of = sys.stdout
        sys.stdout = open(header_file, "w")

        yin_parser.process(yin_file, history_file)
        sys.stdout.close()
        sys.stdout = old_of

    object_history.init(cfg_file + ".hist")

    name = os.path.basename(cfg_file)
    if name.rfind(".") != -1:
        name = name[:name.rfind(".")]

    f = open(out_path + "/" + name + ".h", "w")

    yin_utils.header_file_open(cfg_file, name, f)

    f.write("typedef enum " + model_list_name + " { \n")
    en = object_history.get().get_enum(model_list_name)
    for entry in model_list:
        f.write("    " + entry + " = " + str(en.get_value(entry)) + ", \n")

    f.write("} " + model_list_name + "; \n")