當前位置: 首頁>>代碼示例>>Golang>>正文


Golang OVClient.GetLogicalInterconnectGroupByName方法代碼示例

本文整理匯總了Golang中github.com/HewlettPackard/oneview-golang/ov.OVClient.GetLogicalInterconnectGroupByName方法的典型用法代碼示例。如果您正苦於以下問題:Golang OVClient.GetLogicalInterconnectGroupByName方法的具體用法?Golang OVClient.GetLogicalInterconnectGroupByName怎麽用?Golang OVClient.GetLogicalInterconnectGroupByName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/HewlettPackard/oneview-golang/ov.OVClient的用法示例。


在下文中一共展示了OVClient.GetLogicalInterconnectGroupByName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestDeleteLogicalInterconnectGroup

func TestDeleteLogicalInterconnectGroup(t *testing.T) {
	var (
		d                            *OVTest
		c                            *ov.OVClient
		testName                     string
		testLogicalInterconnectGroup ov.LogicalInterconnectGroup
	)
	if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" {
		d, c = getTestDriverA("test_logical_interconnect_group")
		if c == nil {
			t.Fatalf("Failed to execute getTestDriver() ")
		}
		testName = d.Tc.GetTestData(d.Env, "Name").(string)

		err := c.DeleteLogicalInterconnectGroup(testName)
		assert.NoError(t, err, "DeleteLogicalInterconnectGroup err-> %s", err)

		testLogicalInterconnectGroup, err = c.GetLogicalInterconnectGroupByName(testName)
		assert.NoError(t, err, "GetLogicalInterconnectGroupByName with deleted logical interconnect gorup-> %+v", err)
		assert.Equal(t, "", testLogicalInterconnectGroup.Name, fmt.Sprintf("Problem getting logicalInterconnectGroup name, %+v", testLogicalInterconnectGroup))
	} else {
		_, c = getTestDriverU("test_logical_interconnect_group")
		err := c.DeleteLogicalInterconnectGroup("footest")
		assert.Error(t, err, fmt.Sprintf("ALL ok, no error, caught as expected: %s,%+v\n", err, testLogicalInterconnectGroup))
	}

}
開發者ID:HewlettPackard,項目名稱:oneview-golang,代碼行數:27,代碼來源:logical_interconnect_group_test.go

示例2: TestGetLogicalInterconnectGroupByName

func TestGetLogicalInterconnectGroupByName(t *testing.T) {
	var (
		d        *OVTest
		c        *ov.OVClient
		testName string
	)
	if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" {
		d, c = getTestDriverA("test_logical_interconnect_group")
		if c == nil {
			t.Fatalf("Failed to execute getTestDriver() ")
		}
		testName = d.Tc.GetTestData(d.Env, "Name").(string)

		testLogicalInterconnectGroup, err := c.GetLogicalInterconnectGroupByName(testName)
		assert.NoError(t, err, "GetLogicalInterconnectGroupByName thew an error -> %s", err)
		assert.Equal(t, testName, testLogicalInterconnectGroup.Name)

		testLogicalInterconnectGroup, err = c.GetLogicalInterconnectGroupByName("bad")
		assert.NoError(t, err, "GetLogicalInterconnectGroupByName with fake name -> %s", err)
		assert.Equal(t, "", testLogicalInterconnectGroup.Name)

	} else {
		d, c = getTestDriverU("test_logical_interconnect_group")
		testName = d.Tc.GetTestData(d.Env, "Name").(string)
		data, err := c.GetLogicalInterconnectGroupByName(testName)
		assert.Error(t, err, fmt.Sprintf("ALL ok, no error, caught as expected: %s,%+v\n", err, data))
	}
}
開發者ID:HewlettPackard,項目名稱:oneview-golang,代碼行數:28,代碼來源:logical_interconnect_group_test.go

示例3: TestCreateLogicalInterconnectGroup

func TestCreateLogicalInterconnectGroup(t *testing.T) {
	var (
		d                *OVTest
		interconnectData *OVTest
		c                *ov.OVClient
		testName         string
	)
	if os.Getenv("ONEVIEW_TEST_ACCEPTANCE") == "true" {
		d, c = getTestDriverA("test_logical_interconnect_group")
		if c == nil {
			t.Fatalf("Failed to execute getTestDriver() ")
		}

		interconnectData, c = getTestDriverA("test_interconnect_type")
		if c == nil || interconnectData == nil {
			t.Fatalf("Failed to execute getTestDriver() ")
		}
		testName = d.Tc.GetTestData(d.Env, "Name").(string)
		testLogicalInterconnectGroup, err := c.GetLogicalInterconnectGroupByName(testName)
		assert.NoError(t, err, "CreateLogicalInterconnectGroup get the LogicalInterconnectError error -> %s", err)

		if testLogicalInterconnectGroup.URI.IsNil() {
			/*
				interconnectMapEntryTemplates := make([]ov.InterconnectMapEntryTemplate, 8)
				for i := 0; i < 8; i++ {
					locationEntry1 := ov.LocationEntry{
						RelativeValue: i + 1,
						Type:          "Bay",
					}
					locationEntry2 := ov.LocationEntry{
						RelativeValue: i + 2,
						Type:          "Enclosure",
					}
					locationEntries := make([]ov.LocationEntry, 2)
					locationEntries[0] = locationEntry1
					locationEntries[1] = locationEntry2
					logicalLocation := ov.LogicalLocation{
						LocationEntries: locationEntries,
					}

					interconnectMapEntryTemplate := ov.InterconnectMapEntryTemplate{
						LogicalLocation:              logicalLocation,
						PermittedInterconnectTypeUri: utils.NewNstring(interconnectData.Tc.GetTestData(interconnectData.Env, "URI").(string)),
					}
					interconnectMapEntryTemplates[i] = interconnectMapEntryTemplate
				}
				interconnectMapTemplate := ov.InterconnectMapTemplate{
					InterconnectMapEntryTemplates: interconnectMapEntryTemplates,
				}

				f := false
				tr := true
				ethernetSettings := ov.EthernetSettings{
					Type: "EthernetInterconnectSettingsV3",
					EnableFastMacCacheFailover: &f,
					EnableIgmpSnooping:         &tr,
					EnableRichTLV:              &tr,
					MacRefreshInterval:         10,
					IgmpIdleTimeoutInterval:    250,
				}

				telemetryConfig := ov.TelemetryConfiguration{
					Type:            "telemetry-configuration",
					EnableTelemetry: &tr,
					SampleCount:     12,
					SampleInterval:  150,
				}

				snmpConfiguration := ov.SnmpConfiguration{
					Type:          "snmp-configuration",
					Enabled:       &f,
					ReadCommunity: "test",
					SystemContact: "sys contact",
					SnmpAccess:    []string{"192.168.1.0/24"},
				}

				qosTrafficClassifiers := make([]ov.QosTrafficClassifier, 4)
				qosTrafficClass := ov.QosTrafficClass{
					BandwidthShare:   "10",
					EgressDot1pValue: 5,
					MaxBandwidth:     10,
					RealTime:         &tr,
					ClassName:        "RealTime",
					Enabled:          &tr,
				}
				qosClassificationMap1 := ov.QosClassificationMap{
					Dot1pClassMapping: []int{5, 6, 7},
					DscpClassMapping:  []string{"DSCP 46, EF", "DSCP 40, CS5", "DSCP 48, CS6", "DSCP 56, CS7"},
				}
				qosTrafficClassifier := ov.QosTrafficClassifier{
					QosTrafficClass:          qosTrafficClass,
					QosClassificationMapping: &qosClassificationMap1,
				}
				qosTrafficClassifiers[0] = qosTrafficClassifier

				qosTrafficClass = ov.QosTrafficClass{
					BandwidthShare:   "fcoe",
					EgressDot1pValue: 3,
					MaxBandwidth:     100,
					RealTime:         &f,
//.........這裏部分代碼省略.........
開發者ID:HewlettPackard,項目名稱:oneview-golang,代碼行數:101,代碼來源:logical_interconnect_group_test.go


注:本文中的github.com/HewlettPackard/oneview-golang/ov.OVClient.GetLogicalInterconnectGroupByName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。