/**********************************************************************************/

        private bool doRegisterReports(string reportRequestID = null)
        {
            //ReportDescription reportDescription = m_resources.ReportDescription;
            Dictionary <string, ReportWrapper> reports = m_resources.Reports;

            RegisterReport registerReport;
            CreatedReport  createdReport = null;

            lock (m_ven)
            {
                registerReport = m_ven.registerReport(RandomHex.instance().generateRandomHex(10), reports, reportRequestID);

                // check for piggy backed report requests
                if (registerReport.response.oadrReportRequest != null)
                {
                    // send the createReport callback immediately to allow UI's to update
                    // if there's a one shot or history report request, these reports
                    // need to be registered before processCreatedReport() is called below
                    m_callbacks.processCreateReport(registerReport.response.oadrReportRequest);

                    m_resources.createReport(registerReport.response.oadrReportRequest);

                    // issue a createdReport message using the requestID from the registerReport message
                    createdReport = m_ven.createdReport(registerReport.request.requestID, 200, "OK", m_resources.PendingReports);
                }
            }

            m_callbacks.processRegisterReport(registerReport);

            // the registerReport response included a piggy-backed reportRequest
            if (createdReport != null)
            {
                m_callbacks.processCreatedReport(createdReport);

                // the new report might have a start date of NOW; call sendReports to force
                // the report to be sent immediately
                m_resources.sendReports(DateTime.Now);
            }


            if (registerReport.eiResponseCode != 200)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public void R1_3010_TH_VTN_1()
        {
            VEN2b ven = new VEN2b(new HttpWebRequestWrapper(false, System.Net.SecurityProtocolType.Tls12), TestProperties.vtnURL, TestProperties.venName, "", TestProperties.venPassword);

            QueryRegistration queryRegistration = ven.queryRegistration();

            OadrPoll poll = ven.poll();

            poll.responseTypeIs(typeof(oadrCreateReportType));

            oadrCreateReportType createReport = poll.getCreateReportResponse();

            Console.Out.WriteLine(poll.responseBody);

            ReportDescription reportDescription = new ReportDescription();

            reportDescription.addReport(createReport.oadrReportRequest[0].reportSpecifier.reportSpecifierID, ReportName.TELEMETRY_STATUS, 0, DurationModifier.MINUTES);

            DateTime dtstart = DateTime.UtcNow;

            reportDescription.addIntervalResourceStatus(createReport.oadrReportRequest[0].reportSpecifier.reportSpecifierID, dtstart,
                                                        0, DurationModifier.SECONDS, "rid", 1, (float)1.0, DataQuality.qualityGoodNonSpecific, true, false, (float)1.0, (float)1.0, (float)1.0, (float)1.0,
                                                        (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0,
                                                        (float)1.0, (float)1.0);

            CreatedReport createdReport = ven.createdReport(createReport.requestID, 200, "OK");

            Assert.IsNotNull(createdReport.response);

            List <string> reportSpecifierIDs = new List <string>();

            reportSpecifierIDs.Add(createReport.oadrReportRequest[0].reportSpecifier.reportSpecifierID);

            UpdateReport updateReport = ven.updateReport(createReport.requestID, reportDescription, reportSpecifierIDs, dtstart);

            Assert.IsNotNull(updateReport.response);
        }
Ejemplo n.º 3
0
        public void R1_3020_TH_VTN_1()
        {
            VEN2b ven = new VEN2b(new HttpWebRequestWrapper(false, System.Net.SecurityProtocolType.Tls12), TestProperties.vtnURL, TestProperties.venName, TestProperties.venID, TestProperties.venPassword);

            OadrPoll poll = ven.poll();

            poll.responseTypeIs(typeof(oadrCreateReportType));

            oadrCreateReportType createReport = poll.getCreateReportResponse();

            Console.Out.WriteLine(poll.responseBody);

            ReportDescription reportDescription = new ReportDescription();

            reportDescription.addReport(createReport.oadrReportRequest[0].reportSpecifier.reportSpecifierID, ReportName.TELEMETRY_STATUS, 0, DurationModifier.MINUTES);


            CreatedReport createdReport = ven.createdReport(createReport.requestID, 200, "OK");

            Assert.IsNotNull(createdReport.response);

            List <string> reportSpecifierIDs = new List <string>();

            int sleepTime = (int)(createReport.oadrReportRequest[0].reportSpecifier.reportInterval.properties.dtstart.datetime - DateTime.UtcNow).TotalSeconds;

            if (sleepTime > 0)
            {
                System.Threading.Thread.Sleep(sleepTime * 1000);
            }

            reportSpecifierIDs.Add(createReport.oadrReportRequest[0].reportSpecifier.reportSpecifierID);

            DateTime endTime = createReport.oadrReportRequest[0].reportSpecifier.reportInterval.properties.dtstart.datetime +
                               System.Xml.XmlConvert.ToTimeSpan(createReport.oadrReportRequest[0].reportSpecifier.reportInterval.properties.duration.duration);

            // convert ISO8601 duration to timespan
            // http://stackoverflow.com/questions/62804/how-to-convert-iso-8601-duration-to-timespan-in-vb-net
            // http://msdn.microsoft.com/en-us/library/system.xml.xmlconvert.totimespan.aspx
            int sleepDelay = (int)System.Xml.XmlConvert.ToTimeSpan(createReport.oadrReportRequest[0].reportSpecifier.reportBackDuration.duration).TotalSeconds;

            // the test should continue until the end time has passed, but the test set exits after it receives 2 updates
            // while (DateTime.Now < endTime)
            for (int count = 0; count < 2; count++)
            {
                DateTime dtstart = DateTime.UtcNow;

                reportDescription.addIntervalResourceStatus(createReport.oadrReportRequest[0].reportSpecifier.reportSpecifierID, dtstart,
                                                            0, DurationModifier.SECONDS, "rid", 1, (float)1.0, DataQuality.qualityGoodNonSpecific, true, false, (float)1.0, (float)1.0, (float)1.0, (float)1.0,
                                                            (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0, (float)1.0,
                                                            (float)1.0, (float)1.0);

                UpdateReport updateReport = ven.updateReport(createReport.requestID, reportDescription, reportSpecifierIDs, dtstart);

                Assert.IsNotNull(updateReport.response);

                if (count == 0)
                {
                    System.Threading.Thread.Sleep(sleepDelay * 1000);
                }
            }
        }