Exemple #1
0
        public static LogicalInterfaceInfo LogicalInterface(IBMWIoTP.ApiClient cli, SchemaInfo sc)
        {
            Console.WriteLine("Logical Interface sample request");
            Console.WriteLine("Add Draft LogicalInterface");
            LogicalInterfaceDraft draft = new LogicalInterfaceDraft();

            draft.name        = "lidraft";
            draft.schemaId    = sc.id;
            draft.description = "some thing";
            var li = cli.AddDraftLogicalInterfaces(draft);

            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(li));
            Console.WriteLine("===============================================================================");
            Console.WriteLine("Get all Draft Logical Interfaces");
            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.GetAllDraftLogicalInterfaces()));
            Console.WriteLine("===============================================================================");
            Console.WriteLine("Update Draft Logical Interfaces");
            li.description = "changed to new discription";
            li             = cli.UpdateDraftLogicalInterfaces(li);
            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(li));
            Console.WriteLine("===============================================================================");
            Console.WriteLine("Get Draft Logical Interfaces");
            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.GetDraftLogicalInterfaces(li.id)));
            Console.WriteLine("===============================================================================");
            Console.WriteLine("Perform action on Draft Logical Interfaces");
            OperationInfo work = new OperationInfo(OperationInfo.Validate);

            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.OperateDraftLogicalInterfaces(li.id, work)));

            Console.WriteLine("===============================================================================");
            Console.WriteLine("Delete Draft Logical Interfaces");
            var dummyli = cli.AddDraftLogicalInterfaces(draft);

            cli.DeleteDraftLogicalInterfaces(dummyli.id);
            Console.WriteLine("===============================================================================");
            Console.WriteLine("Get all Draft Logical Interfaces");
            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.GetAllDraftLogicalInterfaces()));
            Console.WriteLine("===============================================================================");

            Console.WriteLine("Get All active Logical Interfaces");
            LogicalInterfaceCollection coll = cli.GetAllActiveLogicalInterfaces();

            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(coll));
            Console.WriteLine("===============================================================================");
            if (coll.results.Count > 0)
            {
                Console.WriteLine("Get active Logical Interfaces");
                Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.GetActiveLogicalInterfaces(coll.results[0].id)));
                Console.WriteLine("===============================================================================");
                Console.WriteLine("Oparate on Logical Interfaces  ");
                work = new OperationInfo(OperationInfo.Deactivate);
                Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.OperateLogicalInterfaces(coll.results[0].id, work)));
                Console.WriteLine("===============================================================================");
            }
            return(li);
        }